package com.ruoyi.system.outto.goods.impl;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.common.auth.CredentialsProvider;
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
import com.aliyun.oss.model.PutObjectRequest;
import com.aliyun.oss.model.PutObjectResult;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.ImgUntil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.system.V2.gameAttr.mapper.GameAttributeMapper;
import com.ruoyi.system.V2.goodInfo.mapper.GoodsInfoImgMapper;
import com.ruoyi.system.V2.inter.mapper.ArtRecMapper;
import com.ruoyi.system.V2.inter.service.ISalePartnerService;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.model.domain.ArtRec;
import com.ruoyi.system.model.domain.GameAttribute;
import com.ruoyi.system.model.domain.GoodsInfoImg;
import com.ruoyi.system.model.domain.SalePartner;
import com.ruoyi.system.model.dto.GoodsInfoAndAttrValueDto;
import com.ruoyi.system.outto.core.JYMRegionalCovert;
import com.ruoyi.system.outto.core.LCConstant;
import com.ruoyi.system.outto.dto.JiaoYiMaoAttrUtil;
import com.ruoyi.system.outto.goods.IJiaoYiMaoAPI;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.net.HttpCookie;
import java.net.URL;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 包赔资料信息表(guarantee_info)表服务实现类
 *
 * @author zyy
 * @date 2023-12-05 18:41:00
 */
@Slf4j
@Service
public class JiaoYiMaoApiImpl implements IJiaoYiMaoAPI {

    @Resource
    private GameAttributeMapper gameAttributeMapper;
    @Resource
    private ArtRecMapper artRecMapper;
    @Resource
    private ISalePartnerService salePartnerService;
    @Autowired
    private ISysUserService sysUserService;
    @Resource
    private SysDictDataMapper sysDictDataMapper;
    @Resource
    private GoodsInfoImgMapper goodsInfoImgMapper;

    String JYMCode = "JYMCode";

//    String string = new String();
//    List<Map<String, Object>> images = new ArrayList<>();


    @Override
    public AjaxResult addGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        HttpResponse response = getToken();
        //获取到token
        HttpCookie m_h5_tk = response.getCookie("_m_h5_tk");
        String _m_h5_tk = m_h5_tk.getValue();
        log.info("获取到的_m_h5_tk={}", _m_h5_tk);

        HttpCookie m_h5_tk_enc = response.getCookie("_m_h5_tk_enc");
        String _m_h5_tk_enc = m_h5_tk_enc.getValue();
        log.info("_m_h5_tk_enc={}", _m_h5_tk_enc);
//        salePartner.setSaleKey("pt1131355qg030632dc2q30tl7grh8yy87xc1qsvkc");

//        12_JIAOYIMAO12JYMCode
//        String reidsKey = salePartner.getSaleName() + salePartner.getTenantId() + JYMCode;
//        Object cacheObject = redisCache.getCacheObject(reidsKey);
//        if (Objects.isNull(cacheObject)) {
//            throw new GlobalException("未找到JYMCode");
//        }
//        String str = cacheObject.toString();
        String str = salePartner.getSaleKey();
        System.out.println("str:" + str);

        String cookie = JiaoYiMaoAttrUtil.getCookie(_m_h5_tk, _m_h5_tk_enc, salePartner.getSaleKey());
        Map<String, Object> result = new TreeMap<>();
        //封装参数
        String data = params(goodsInfoAndAttrValueDto, _m_h5_tk, cookie, salePartner);

        log.info("data={}", data);

        String jsv = "2.7.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();

        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post("https://mtop.jiaoyimao.com/h5/mtop.jym.jymsell.item.publish.pc" +
                ".publishiteminpc/1.0/")
                .form("data", data)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .form("dataType", "json")
                .form("valueType", "original")
                .form("api", "mtop.jym.jymsell.item.publish.pc.publishItemInPc")
                .form("v", "1.0")
                .form("type", "originaljson")
                .form("preventFallback", "true")
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-session-id", str)
                .header("origin", "https://www.jiaoyimao.com")
                .header("referer", "https://www.jiaoyimao.com/")
                .header("jym-meta-h5", "{\"sid\":\"3031712045635546\",\"ssids\":\"3031712045635546\"," +
                        "\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\"," +
                        "\"terminal\":\"pc\"," +
                        "\"osCode\":\"other\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();
        String body = rawResponse.body();
        log.info(body);
        System.out.println(body);
        String data1 = JSONObject.parseObject(body).getString("data");
        String result2 = JSONObject.parseObject(data1).getString("result");
        String success = JSONObject.parseObject(result2).getString("success");
        if ("false".equals(success)) {
            result.put("code", 500);
            result.put("msg", JSONObject.parseObject(result2).getString("propertyErrorMap"));
        } else {
            result.put("code", 200);
            String result1 = JSONObject.parseObject(data1).getString("result");
            String goodsId = JSONObject.parseObject(result1).getString("goodsId");

            ArtRec artRecreq = new ArtRec();
            artRecreq.setConfig(salePartner.getId());
            artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
            List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
            if (artRecs.size() > 0) {
                artRecs.get(0).setOutid(goodsId);
                artRecMapper.updateArtRec(artRecs.get(0));
            } else {
                artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
                artRecreq.setCreateId(goodsInfoAndAttrValueDto.getCreateId());
                artRecreq.setType(LCConstant.interAdd);
                artRecreq.setConfig(salePartner.getId());
                artRecreq.setSaleCode(salePartner.getSaleName());
                artRecreq.setOutid(goodsId);
                artRecMapper.insertArtRec(artRecreq);
            }
        }
        result.put("req", data);
        result.put("res", data1);

        return AjaxResult.success(result);
    }

    @Override
    public AjaxResult editGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        Map<String, Object> result = new HashMap<>();
        AjaxResult ajaxResult = delGame(goodsInfoAndAttrValueDto, salePartner);
        Object data = MapUtils.getObject(ajaxResult, "data");
        String s = JSONObject.toJSONString(data);
        JSONObject jsonObject = JSONObject.parseObject(s);
        if (jsonObject.getString("code").equals("200")) {
            result.put("code", 200);
            AjaxResult ajaxResult1 = addGame(goodsInfoAndAttrValueDto, salePartner);
            return ajaxResult1;
        } else {
            result.put("code", 500);
            result.put("msg", jsonObject.getString("res"));
        }
//        HttpResponse response = getToken();
//        //获取到token
//        HttpCookie m_h5_tk = response.getCookie("_m_h5_tk");
//        String _m_h5_tk = m_h5_tk.getValue();
//        log.info("获取到的_m_h5_tk={}", _m_h5_tk);
//
//        HttpCookie m_h5_tk_enc = response.getCookie("_m_h5_tk_enc");
//        String _m_h5_tk_enc = m_h5_tk_enc.getValue();
//        log.info("_m_h5_tk_enc={}", _m_h5_tk_enc);
//
//        String cookie = "cna=ELz2HdeMWE0CASrvtv8g0GPP; ssids=2151706171272252;
//        logTraceJymId=7979a277a8f7-4ac1-9673-c5c5;
//        track_id=gcmall_1706171272984_20badffa-bff2-468c-ab69-2b489280641e; t=760ce99ede3c17ff4a9854e748e95e99;
//        _bl_uid=bwlgXrU5va1gdbxgmtp0q9ys9p3p; aplus_ieu_ch=10438; ctoken=QLk4nT7MY9W1Ms_5x8BEH0po; _m_h5_tk=" +
//        _m_h5_tk + "; _m_h5_tk_enc=" + _m_h5_tk_enc + "; xlly_s=1;
//        Hm_lvt_47366dcc92e834539e7e9c3dcc2441de=1707798155,1709021805; _samesite_flag_=true;
//        cookie2=1ac5b7e20db0c4ed82b1b12864f05c97; _tb_token_=e6b53b3379018; ieu_member_biz_id=jiaoyimao;
//        csg=ce33c43a; ieu_member_uid=1544521729220323; jym_session_id=" + salePartner.getSaleKey() + ";
//        ieu_member_sid=" + salePartner.getSaleKey() + "; actk=1861a9538d288c8d8ab3a3466972eeee;
//        sfroms=JIAOYIMALL001; external_login_type=2; ssts=960d7b2550750c2473c6488c47426b8c;
//        actks=dc50e594cc88972d7e4b0db1f1fca1b7;
//        EGG_SESS=3v6DgAB-jKbLOzN5Qa1pFi5yHoQKYp1Php5wCXl9Vy7Ix_eco_QOS_jC
//        -0TzxDVnsrktE84L7AheQVsGJ4JQDb6KKG_EzHd85uOlGxc2-IHSUPiqfgb0GIfF9hjMQCbp; session=1709023162661780-9;
//        t_id=0dba2a925449-4eae-96c5-db943e8d4475; p_id=351ffa81d09b-4556-8063-bef2b0a68739;
//        Hm_lpvt_47366dcc92e834539e7e9c3dcc2441de=1709023449;
//        tfstk=ewuMjDAeYcr6NwRmFAU6JOYzhAxpUPa_uIDYH-h4352QQlhqDE4mLfcTXhatx-DEKRrv1NhduxDE6N3xoD_mNjg91rd_5fabuLpJy
//        -cs1r_aP9_pykTLlJpJeULLVcT0NLnOOHjRYkSFJzpxzwE_E_brTJuJSLes_JbosJVaMGwYKZ7qHDcLUUehuZu3sgSlYgWS6ZwJ
//        -jsfclPQt8nOGOEyttDyZBAhqXraOWoDtBjfclPQt8dHtgcUbWNEm;
//        isg=BP7-vrQ6F3QlpUI3-qcVXCpCTxRAP8K5s6p_XqgHQcOsS8QlcM4xy1NtxxGH87rR";
//
//        Map<String, Object> result = new TreeMap<>();
//        Map<String,Object> params = new HashMap<>();
//        Map<String,Object> header = new HashMap<>();
//        params.put("goodsId",goodsInfoAndAttrValueDto.getOutId());
//        params.put("newPrice",goodsInfoAndAttrValueDto.getPrice());
//        header.put("Actk","dc50e594cc88972d7e4b0db1f1fca1b7");
//        header.put("Cookie",cookie);
//        String baseUrl = "https://www.jiaoyimao.com/pc/ajax/sellerAjax/updateGoodsPrice";
//        String s = HttpUtils.doPostForm(baseUrl, params, header);
//        String stateCode = JSONObject.parseObject(s).getString("stateCode");
//        if (!"200".equals(stateCode)) {
//            result.put("code", 500);
//        } else {
//            result.put("code", 200);
//        }
//        result.put("req", JSONObject.toJSONString(params));
//        result.put("res", stateCode);
//        result.put("msg", stateCode);
        return AjaxResult.success(result);
    }

    @Override
    public AjaxResult delGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        Map<String, Object> result = new HashMap<>();
        HttpResponse response = getToken();
        //获取到token
        HttpCookie m_h5_tk = response.getCookie("_m_h5_tk");
        String _m_h5_tk = m_h5_tk.getValue();
        log.info("获取到的_m_h5_tk={}", _m_h5_tk);

        HttpCookie m_h5_tk_enc = response.getCookie("_m_h5_tk_enc");
        String _m_h5_tk_enc = m_h5_tk_enc.getValue();
        log.info("_m_h5_tk_enc={}", _m_h5_tk_enc);

        String cookie = JiaoYiMaoAttrUtil.getCookie(_m_h5_tk, _m_h5_tk_enc, salePartner.getSaleKey());

        ArtRec artRecreq = new ArtRec();
        artRecreq.setConfig(salePartner.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
        ArtRec artRec = artRecs.get(0);
        //先调撤回
        String string = withdraw(cookie, _m_h5_tk, artRec.getOutid());
        String data = JSONObject.parseObject(string).getString("data");
        String results = JSONObject.parseObject(data).getString("result");
        String success = JSONObject.parseObject(results).getString("success");
        //撤回失败调下架
        if (success.equals("false")) {
            String down = down(cookie, _m_h5_tk, artRec.getOutid());
            String data1 = JSONObject.parseObject(down).getString("data");
            String result1 = JSONObject.parseObject(data1).getString("result");
            String success1 = JSONObject.parseObject(result1).getString("success");
            if(success1.equals("true")){
                result.put("code", 200);
                result.put("msg", JSONObject.parseObject(data1).getString("extraErrMsg"));
            }else {
                result.put("code", 500);
                result.put("res", down);
                result.put("msg", down);
            }
        } else {
            result.put("req", goodsInfoAndAttrValueDto.getOutId());
            result.put("res", string);
            result.put("msg", JSONObject.parseObject(results).getString("failureMessage"));
            result.put("code", 200);
        }
        return AjaxResult.success(result);
    }


    private String params(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, String _m_h5_tk, String cookie,
                          SalePartner salePartner) {
        JSONObject dataJson = new JSONObject();
        dataJson.put("title", "商品标题将由系统生成");

        GoodsInfoImg goodsInfoImg = new GoodsInfoImg();
        goodsInfoImg.setGoodsId(goodsInfoAndAttrValueDto.getId());
        goodsInfoImg.setType(Constants.STR_1);
        List<GoodsInfoImg> infoImgs = goodsInfoImgMapper.selectGoodsInfoImgList(goodsInfoImg);
        if(infoImgs.size()>25){
            infoImgs = infoImgs.subList(0,24);
        }
        String imgs = infoImgs.stream().map(i -> i.getImgUrl()).collect(Collectors.joining(","));
        Map<String, Object> imgMap = imgUpload(cookie, _m_h5_tk, imgs);

        dataJson.put("image", JSONObject.toJSONString(imgMap.get("images")));
        dataJson.put("imageIdListStr", imgMap.get("imageIdListStr"));

        //过滤关键词
        String des = guolvDes(goodsInfoAndAttrValueDto.getDes());
        dataJson.put("description", des.length() > 100 ? des.substring(0, 100) : des);
        dataJson.put("price", goodsInfoAndAttrValueDto.getPrice());
        dataJson.put("priceYuan", goodsInfoAndAttrValueDto.getPrice());
        dataJson.put("storage", "1");
        dataJson.put("_protocol", "true");
        dataJson.put("modelType", "pc");
        dataJson.put("goodsDefTravelContent", "{\"forceBargain\":true}");
        dataJson.put("addlService", "{\"supportBargain\":false}");
        dataJson.put("propertyRecognizeType", "0");


        if (goodsInfoAndAttrValueDto.getGameName().equals("王者荣耀")) {
            //服务器
            dataJson.put("keyProperties", "[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");

            String gameId = "1002416";
            String clientId = "";
            String categoryId = "";
            String platformId = "";

            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")) {
                clientId = "1470047031091455";
                categoryId = "1696673668826299";
                platformId = "2";
            }else if(regional.equals("安卓微信")){
                clientId = "1470047033047733";
                categoryId = "1696674026557889";
                platformId = "2";
            }else if(regional.equals("苹果QQ")){
                clientId = "1470047031280559";
                categoryId = "1696674169548339";
                platformId = "3";
            }else {
                clientId = "1499667551454656";
                categoryId = "1696674279943206";
                platformId = "3";
            }

            String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\""+platformId+"\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";
            System.out.println(data1);

            String attr = getAttr(data1,salePartner);
            String data = JSONObject.parseObject(attr).getString("data");
            String result = JSONObject.parseObject(data).getString("result");
            String categoryBaseInfo = JSONObject.parseObject(result).getString("categoryBaseInfo");
            String sellerAccountPropertiess = JSONObject.parseObject(result).getString("sellerAccountProperties");
            JSONArray jsonArray2 = JSONArray.parseArray(sellerAccountPropertiess);
            //账号信息
            Map<String,Object> sellerAccountProperties = new HashMap<>();
            List list = new ArrayList<>();
            for(Object o : jsonArray2){
                sellerAccountProperties = new HashMap<>();
                if(JSONObject.parseObject(o.toString()).getString("propertyName").contains("帐号")) {
                    //"游戏帐号"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", goodsInfoAndAttrValueDto.getAccountNumber().substring(0,goodsInfoAndAttrValueDto.getAccountNumber().length()-2)+ RandomUtil.randomNumbers(2));
                }else if(JSONObject.parseObject(o.toString()).getString("propertyName").contains("密码")) {
                    //"游戏密码"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", String.valueOf(System.currentTimeMillis()).substring(3));
                }else {
                    // 手机号码
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value",salePartner.getOther());
                }
                list.add(sellerAccountProperties);
            }
            dataJson.put("sellerAccountProperties",JSONObject.toJSONString(list));
            Map<String,Object> gameProperty = new HashMap<>();
            gameProperty.put("gameId",JSONObject.parseObject(categoryBaseInfo).getString("newGameId"));
            gameProperty.put("platformId",JSONObject.parseObject(categoryBaseInfo).getString("platformId"));
            if(regional.equals("安卓QQ")) {
                gameProperty.put("clientId","1470047031091455");
                gameProperty.put("categoryId","1696673668826299");
                dataJson.put("categoryId","1696673668826299");
                gameProperty.put("serverId","1701247105972940");
            }else if(regional.equals("安卓微信")){
                gameProperty.put("clientId","1470047033047733");
                gameProperty.put("categoryId","1696674026557889");
                dataJson.put("categoryId","1696674026557889");
                gameProperty.put("serverId","1701247130377155");
            }else if(regional.equals("苹果QQ")){
                gameProperty.put("clientId","1470047031280559");
                gameProperty.put("categoryId","1696674169548339");
                dataJson.put("categoryId","1696674169548339");
                gameProperty.put("serverId","1701247154492446");
            }else {
                gameProperty.put("clientId","1499667551454656");
                gameProperty.put("categoryId","1696674279943206");
                dataJson.put("categoryId","1696674279943206");
                gameProperty.put("serverId","1701247174193015");
            }

            dataJson.put("gameProperty", JSONObject.toJSONString(gameProperty));

            //属性
            Map<String, Object> extProperties = new HashMap<>();
            String extPropertiess = JSONObject.parseObject(result).getString("extProperties");
            JSONArray jsonArray3 = JSONArray.parseArray(extPropertiess);
            list = new ArrayList<>();
            for (Object o : jsonArray3) {
                extProperties = new HashMap<>();
                extProperties.put("multiSubPropertyInfoList", new ArrayList<>());
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("可二次实名")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF16())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF16()));
                        if (gameAttribute1.getFieldName().equals("可二次实名")) {
                            extProperties.put("value", "可二次实名");
                        } else {
                            extProperties.put("value", "不可二次实名");
                        }
                    } else {
                        extProperties.put("value", "不可二次实名");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF9());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF21());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF12());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF11());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF15());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF24());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            String fieldName = gameAttribute1.getFieldName();
                            for (Object p : jsonArray1) {
                                String name = JSONObject.parseObject(p.toString()).getString("name");
                                if (name.contains("-")) {
                                    String[] split = name.split("-");
                                    name = split[1] + " " + split[0];
                                }
                                if (fieldName.equals(name)) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("英雄")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF5());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("典藏皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF9())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF9().split(",").length);
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("星传说皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF26())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF26().split(",").length);
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("传说皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF12())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF12().split(",").length);
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("史诗皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF11().split(",").length);
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF8())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF8());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("英雄数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF7());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("VIP等级")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                        extProperties.put("value", gameAttribute1.getFieldName().replace("V", ""));
                    } else {
                        extProperties.put("value", "1");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("段位")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray = JSONArray.parseArray(options);
                        for (Object p : jsonArray) {
                            if (JSONObject.parseObject(p.toString()).getString("value").contains(gameAttribute1.getFieldName())) {
                                extProperties.put("value", JSONObject.parseObject(p.toString()).getString("value"));
                            }
                        }
                    } else {
                        extProperties.put("value", "倔强青铜I");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("营地id")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF17())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF17());
                    } else {
                        throw new GlobalException("营地ID不能为空!!!");
                    }
                }
                if (Objects.nonNull(extProperties.get("propertyId"))) {
                    list.add(extProperties);
                }
            }
            dataJson.put("extProperties", JSONObject.toJSONString(list));
        }

        if (goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟")){
            dataJson.put("goodsDefTravelContent", "");
            dataJson.put("propertyRecognizeType", "1");
            //服务器
            dataJson.put("keyProperties","[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");

            dataJson.put("description",goodsInfoAndAttrValueDto.getDes().substring(0,50));

            String gameId = "1005654";
            String clientId = "1472625225736942";
            String categoryId = "1719886237225367";

            String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\"5\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";
            String attr = getAttr(data1,salePartner);
            String data = JSONObject.parseObject(attr).getString("data");
            String result = JSONObject.parseObject(data).getString("result");
            String categoryBaseInfo = JSONObject.parseObject(result).getString("categoryBaseInfo");
            String sellerAccountPropertiess = JSONObject.parseObject(result).getString("sellerAccountProperties");
            JSONArray jsonArray2 = JSONArray.parseArray(sellerAccountPropertiess);

            //账号信息
            Map<String,Object> sellerAccountProperties = new HashMap<>();
            List list = new ArrayList<>();
            for(Object o : jsonArray2){
                sellerAccountProperties = new HashMap<>();
                if(JSONObject.parseObject(o.toString()).getString("propertyName").equals("QQ帐号")) {
                    //"游戏帐号"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", goodsInfoAndAttrValueDto.getAccountNumber().substring(0,goodsInfoAndAttrValueDto.getAccountNumber().length()-2)+ RandomUtil.randomNumbers(2));
                }else if(JSONObject.parseObject(o.toString()).getString("propertyName").equals("QQ密码")) {
                    //"游戏密码"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", String.valueOf(System.currentTimeMillis()).substring(3));
                }else if(JSONObject.parseObject(o.toString()).getString("propertyName").equals("手机号码")){
                    // 手机号码
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value",salePartner.getOther());
                }
                list.add(sellerAccountProperties);
            }
            dataJson.put("sellerAccountProperties",JSONObject.toJSONString(list));
            dataJson.put("categoryId","1719886237225367");
            Map<String,Object> gameProperty = new HashMap<>();
            gameProperty.put("gameId",JSONObject.parseObject(categoryBaseInfo).getString("newGameId"));
            gameProperty.put("platformId",JSONObject.parseObject(categoryBaseInfo).getString("platformId"));
            gameProperty.put("clientId","1472625225736942");
            gameProperty.put("categoryId","1719886237225367");
            String qufu = "[{\"gameId\":1005654,\"grade\":31,\"id\":1517384142749498,\"isTop\":2,\"name\":\"峡谷之巅\"},{\"gameId\":1005654,\"grade\":30,\"id\":1500544100659844,\"isTop\":2,\"name\":\"男爵领域\"},{\"gameId\":1005654,\"grade\":29,\"id\":1500544100659842,\"isTop\":2,\"name\":\"教育网专区\"},{\"gameId\":1005654,\"grade\":28,\"id\":1500530737314623,\"isTop\":2,\"name\":\"钢铁烈阳\"},{\"gameId\":1005654,\"grade\":27,\"id\":1500530737313622,\"isTop\":2,\"name\":\"雷瑟守备\"},{\"gameId\":1005654,\"grade\":26,\"id\":1500530737313621,\"isTop\":2,\"name\":\"皮城警备\"},{\"gameId\":1005654,\"grade\":25,\"id\":1500530737313620,\"isTop\":2,\"name\":\"影流\"},{\"gameId\":1005654,\"grade\":24,\"id\":1500530737313618,\"isTop\":2,\"name\":\"水晶之痕\"},{\"gameId\":1005654,\"grade\":23,\"id\":1500530737313615,\"isTop\":2,\"name\":\"暗影岛\"},{\"gameId\":1005654,\"grade\":22,\"id\":1500530737313614,\"isTop\":2,\"name\":\"裁决之地\"},{\"gameId\":1005654,\"grade\":21,\"id\":1500530737313612,\"isTop\":2,\"name\":\"扭曲丛林\"},{\"gameId\":1005654,\"grade\":20,\"id\":1500530737312610,\"isTop\":2,\"name\":\"无畏先锋\"},{\"gameId\":1005654,\"grade\":19,\"id\":1500530737312608,\"isTop\":2,\"name\":\"德玛西亚\"},{\"gameId\":1005654,\"grade\":18,\"id\":1500530737312607,\"isTop\":2,\"name\":\"巨龙之巢\"},{\"gameId\":1005654,\"grade\":17,\"id\":1500530737312603,\"isTop\":2,\"name\":\"恕瑞玛\"},{\"gameId\":1005654,\"grade\":16,\"id\":1500530737312601,\"isTop\":2,\"name\":\"弗雷尔卓德\"},{\"gameId\":1005654,\"grade\":15,\"id\":1500450488530356,\"isTop\":2,\"name\":\"卡拉曼达\"},{\"gameId\":1005654,\"grade\":14,\"id\":1500450488530355,\"isTop\":2,\"name\":\"征服之海\"},{\"gameId\":1005654,\"grade\":13,\"id\":1500450488530354,\"isTop\":2,\"name\":\"守望之海\"},{\"gameId\":1005654,\"grade\":12,\"id\":1500450488530353,\"isTop\":2,\"name\":\"均衡教派\"},{\"gameId\":1005654,\"grade\":11,\"id\":1500450488530352,\"isTop\":2,\"name\":\"黑色玫瑰\"},{\"gameId\":1005654,\"grade\":10,\"id\":1500450488529351,\"isTop\":2,\"name\":\"巨神峰\"},{\"gameId\":1005654,\"grade\":9,\"id\":1500450488529349,\"isTop\":2,\"name\":\"战争学院\"},{\"gameId\":1005654,\"grade\":8,\"id\":1500450488529347,\"isTop\":2,\"name\":\"皮尔特沃夫\"},{\"gameId\":1005654,\"grade\":7,\"id\":1500450488529346,\"isTop\":2,\"name\":\"班德尔城\"},{\"gameId\":1005654,\"grade\":6,\"id\":1500450488529344,\"isTop\":2,\"name\":\"诺克萨斯\"},{\"gameId\":1005654,\"grade\":5,\"id\":1500450488529342,\"isTop\":2,\"name\":\"祖安\"},{\"gameId\":1005654,\"grade\":4,\"id\":1500450488529341,\"isTop\":2,\"name\":\"比尔吉沃特\"},{\"gameId\":1005654,\"grade\":3,\"id\":1500450488528338,\"isTop\":2,\"name\":\"艾欧尼亚\"}]\n";
            JSONArray jsonArray = JSONArray.parseArray(qufu);
            for(Object o : jsonArray){
                if(JSONObject.parseObject(o.toString()).getString("name").equals(goodsInfoAndAttrValueDto.getServerName())){
                    gameProperty.put("serverId",JSONObject.parseObject(o.toString()).getString("id"));
                    break;
                }
            }
            dataJson.put("gameProperty", JSONObject.toJSONString(gameProperty));

            //属性
            Map<String,Object> extProperties = new HashMap<>();
            String extPropertiess = JSONObject.parseObject(result).getString("extProperties");
            JSONArray jsonArray3 = JSONArray.parseArray(extPropertiess);
            list = new ArrayList<>();
            for(Object o : jsonArray3) {
                extProperties = new HashMap<>();
                extProperties.put("multiSubPropertyInfoList", new ArrayList<>());
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("可二次实名")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                        if (gameAttribute1.getFieldName().equals("有修改人脸机会/实名是本人")) {
                            extProperties.put("value", "可二次实名");
                        } else {
                            extProperties.put("value", "不可二次实名");
                        }
                    } else {
                        extProperties.put("value", "不可二次实名");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF7());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF8());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF9());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF10());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF11());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF12());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF13());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF14());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF15());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF16());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF17());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF24());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF25());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF26());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF27());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF28());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF29());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF30());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("臻彩")) {
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF24())){
                        List<GameAttribute> gameAttributs = getGameAttributs(goodsInfoAndAttrValueDto.getF24());
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        String wuqi = "";
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (onlyHanZi(gameAttribute1.getFieldName()).equals(onlyHanZi(JSONObject.parseObject(p.toString()).getString("name")))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                        if (StringUtils.isNotEmpty(wuqi)) {
                            extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                            extProperties.put("value", wuqi.substring(1));
                        }
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("终极数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF17())?goodsInfoAndAttrValueDto.getF17().split(",").length:"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("神话数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF26())?goodsInfoAndAttrValueDto.getF26().split(",").length:"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("臻彩数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF23())?goodsInfoAndAttrValueDto.getF23():"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("限定数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF19())?goodsInfoAndAttrValueDto.getF19():"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("传说数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF20())?goodsInfoAndAttrValueDto.getF20():"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("史诗数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF29())?goodsInfoAndAttrValueDto.getF29().split(",").length:"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())?goodsInfoAndAttrValueDto.getF4():"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("炫彩数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())?goodsInfoAndAttrValueDto.getF5():"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("英雄数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())?goodsInfoAndAttrValueDto.getF3():"0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("段位")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                        extProperties.put("value", gameAttribute1.getFieldName().replace("未定级","无"));
                    }else {
                        extProperties.put("value", "无");
                    }
                }
                if(Objects.nonNull(extProperties.get("propertyId"))) {
                    list.add(extProperties);
                }
            }
            dataJson.put("extProperties",JSONObject.toJSONString(list));
        }

        if (goodsInfoAndAttrValueDto.getGameName().equals("英雄联盟手游")){
            //服务器
            dataJson.put("keyProperties", "[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");

            String gameId = "10011519";
            String clientId = "";
            String categoryId = "";

            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")) {
                clientId = "1470047031091455";
                categoryId = "1719886462779126";
            }else if(regional.equals("安卓微信")){
                clientId = "1470047033047733";
                categoryId = "1652861430355356";
            }else if(regional.equals("苹果QQ")){
                clientId = "1470047031280559";
                categoryId = "1719886587303694";
            }else {
                clientId = "1499667551454656";
                categoryId = "1652861525432266";
            }

            String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\"3\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";
            System.out.println(data1);

            String attr = getAttr(data1,salePartner);
        }

        if (goodsInfoAndAttrValueDto.getGameName().equals("枪战王者")) {
            dataJson.put("goodsDefTravelContent", "");
            dataJson.put("propertyRecognizeType", "1");
            //服务器
            dataJson.put("keyProperties", "[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");

            String gameId = "1002600";
            String clientId = "";
            String categoryId = "";
            String platformId = "";
            String regional = goodsInfoAndAttrValueDto.getSystemName() + goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")) {
                clientId = "1470047031091455";
                categoryId = "1692936074107541";
                platformId = "2";
            }else if(regional.equals("安卓微信")){
                clientId = "1470047033047733";
                categoryId = "1709000330746383";
                platformId = "2";
            }else if(regional.equals("苹果QQ")){
                clientId = "1470047031280559";
                categoryId = "1693204341361682";
                platformId = "3";
            }else {
                clientId = "1499667551454656";
                categoryId = "1709000423816293";
                platformId = "3";
            }


            String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\""+platformId+"\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";

            String attr = getAttr(data1,salePartner);
            String data = JSONObject.parseObject(attr).getString("data");
            String result = JSONObject.parseObject(data).getString("result");
            String categoryBaseInfo = JSONObject.parseObject(result).getString("categoryBaseInfo");
            String sellerAccountPropertiess = JSONObject.parseObject(result).getString("sellerAccountProperties");
            JSONArray jsonArray2 = JSONArray.parseArray(sellerAccountPropertiess);
            //账号信息
            Map<String, Object> sellerAccountProperties = new HashMap<>();
            List list = new ArrayList<>();
            for (Object o : jsonArray2) {
                sellerAccountProperties = new HashMap<>();
                if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("帐号")) {
                    //"游戏帐号"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", goodsInfoAndAttrValueDto.getAccountNumber().substring(0,goodsInfoAndAttrValueDto.getAccountNumber().length()-2)+ RandomUtil.randomNumbers(2));
                } else if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("密码")) {
                    //"游戏密码"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", String.valueOf(System.currentTimeMillis() / 1000));
                } else {
                    // 手机号码
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", salePartner.getOther());
                }
                list.add(sellerAccountProperties);
            }
            dataJson.put("sellerAccountProperties", JSONObject.toJSONString(list));

            Map<String, Object> gameProperty = new HashMap<>();
            gameProperty.put("gameId", JSONObject.parseObject(categoryBaseInfo).getString("newGameId"));
            gameProperty.put("platformId", JSONObject.parseObject(categoryBaseInfo).getString("platformId"));
            if (regional.equals("安卓QQ")) {
                gameProperty.put("clientId", "1470047031091455");
                gameProperty.put("categoryId", "1692936074107541");
                dataJson.put("categoryId", "1692936074107541");
                gameProperty.put("serverId", "680750");
            } else if (regional.equals("安卓微信")) {
                gameProperty.put("clientId", "1470047033047733");
                gameProperty.put("categoryId", "1709000330746383");
                dataJson.put("categoryId", "1709000330746383");
                gameProperty.put("serverId", "1499673572723335");
            } else if (regional.equals("苹果QQ")) {
                gameProperty.put("clientId", "1470047031280559");
                gameProperty.put("categoryId", "1693204341361682");
                dataJson.put("categoryId", "1693204341361682");
                gameProperty.put("serverId", "769229");
            } else {
                gameProperty.put("clientId", "1499667551454656");
                gameProperty.put("categoryId", "1709000423816293");
                dataJson.put("categoryId", "1709000423816293");
                gameProperty.put("serverId", "1499673599536190");
            }
            dataJson.put("gameProperty", JSONObject.toJSONString(gameProperty));


            Map<String, Object> extProperties = new HashMap<>();
            String extPropertiess = JSONObject.parseObject(result).getString("extProperties");
            JSONArray jsonArray3 = JSONArray.parseArray(extPropertiess);
            list = new ArrayList<>();
            for (Object o : jsonArray3) {
                extProperties = new HashMap<>();
                extProperties.put("multiSubPropertyInfoList", new ArrayList<>());
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("是否可二次")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF10())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
                        if (gameAttribute1.getFieldName().equals("有修改人脸机会/实名是本人")) {
                            extProperties.put("value", "可二次实名");
                        } else {
                            extProperties.put("value", "不可二次实名");
                        }
                    } else {
                        extProperties.put("value", "不可二次实名");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("武器")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF7());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF11());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("角色")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF8());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("王者武器")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF11().split(",").length);
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("英雄武器")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF5());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("英雄角色")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF8())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF8().split(",").length);
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("万化")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", 0);
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("段位")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "新锐");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("VIP等级")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));

                        extProperties.put("value", gameAttribute1.getFieldName().replace("无", "1").replace("V", ""));
                    } else {
                        extProperties.put("value", "1");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF7());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (Objects.nonNull(extProperties.get("propertyId"))) {
                    list.add(extProperties);
                }
            }
            dataJson.put("extProperties", JSONObject.toJSONString(list));
        }

        if (goodsInfoAndAttrValueDto.getGameName().equals("和平精英")) {
            //服务器
            dataJson.put("keyProperties", "[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");

            String gameId = "1006473";
            String clientId = "";
            String categoryId = "";
            String platformId = "";
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")) {
                clientId = "1470047031091455";
                categoryId = "1702277118311394";
                platformId = "2";
            }else if(regional.equals("安卓微信")){
                clientId = "1470047033047733";
                categoryId = "1702277282513436";
                platformId = "2";
            }else if(regional.equals("苹果QQ")){
                clientId = "1470047031280559";
                categoryId = "1702277221069459";
                platformId = "3";
            }else {
                clientId = "1499667551454656";
                categoryId = "1702277332046662";
                platformId = "3";
            }

            String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\""+platformId+"\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";
            System.out.println(data1);
            String attr = getAttr(data1,salePartner);
            String data = JSONObject.parseObject(attr).getString("data");
            String result = JSONObject.parseObject(data).getString("result");
            String categoryBaseInfo = JSONObject.parseObject(result).getString("categoryBaseInfo");
            String sellerAccountPropertiess = JSONObject.parseObject(result).getString("sellerAccountProperties");
            JSONArray jsonArray2 = JSONArray.parseArray(sellerAccountPropertiess);
            //账号信息
            Map<String, Object> sellerAccountProperties = new HashMap<>();
            List list = new ArrayList<>();
            for (Object o : jsonArray2) {
                sellerAccountProperties = new HashMap<>();
                if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("帐号")) {
                    //"游戏帐号"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", goodsInfoAndAttrValueDto.getAccountNumber().substring(0,goodsInfoAndAttrValueDto.getAccountNumber().length()-2)+ RandomUtil.randomNumbers(2));
                } else if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("密码")) {
                    //"游戏密码"1
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", String.valueOf(System.currentTimeMillis() / 1000));
                } else {
                    // 手机号码
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", salePartner.getOther());
                }
                list.add(sellerAccountProperties);
            }
            dataJson.put("sellerAccountProperties", JSONObject.toJSONString(list));
            Map<String, Object> gameProperty = new HashMap<>();
            gameProperty.put("gameId", JSONObject.parseObject(categoryBaseInfo).getString("newGameId"));
            gameProperty.put("platformId", JSONObject.parseObject(categoryBaseInfo).getString("platformId"));
            if (regional.equals("安卓QQ")) {
                gameProperty.put("clientId", "1470047031091455");
                gameProperty.put("categoryId", "1702277118311394");
                dataJson.put("categoryId", "1702277118311394");
                gameProperty.put("serverId", "1535364157745866");
            } else if (regional.equals("安卓微信")) {
                gameProperty.put("clientId", "1470047033047733");
                gameProperty.put("categoryId", "1702277282513436");
                dataJson.put("categoryId", "1702277282513436");
                gameProperty.put("serverId", "1539844286658920");
            } else if (regional.equals("苹果QQ")) {
                gameProperty.put("clientId", "1470047031280559");
                gameProperty.put("categoryId", "1702277221069459");
                dataJson.put("categoryId", "1702277221069459");
                gameProperty.put("serverId", "1535364178344308");
            } else {
                gameProperty.put("clientId", "1499667551454656");
                gameProperty.put("categoryId", "1702277332046662");
                dataJson.put("categoryId", "1702277332046662");
                gameProperty.put("serverId", "1539844295575679");
            }
            dataJson.put("gameProperty", JSONObject.toJSONString(gameProperty));

            //属性
            Map<String, Object> extProperties = new HashMap<>();
            String extPropertiess = JSONObject.parseObject(result).getString("extProperties");
            JSONArray jsonArray3 = JSONArray.parseArray(extPropertiess);
            list = new ArrayList<>();
            for (Object o : jsonArray3) {
                extProperties = new HashMap<>();
                extProperties.put("multiSubPropertyInfoList", new ArrayList<>());
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("可二次实名")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF10())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
                        if (gameAttribute1.getFieldName().equals("可二次实名")) {
                            extProperties.put("value", "可二次实名");
                        } else {
                            extProperties.put("value", "不可二次实名");
                        }
                    } else {
                        extProperties.put("value", "不可二次实名");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("载具")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF2());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().replace("玛莎拉蒂G幻星粉", "玛莎拉蒂Grecale(幻星粉)")
                                        .replace("玛莎拉蒂G绿色", "玛莎拉蒂Grecale(薄荷绿)").replace("玛莎拉蒂M幻星粉", "玛莎拉蒂MC20(幻星粉)")
                                        .replace("自由的鲸", "快艇-自由的鲸").replace("路特斯EL紫色", "路特斯ELETRE(电光紫)")
                                        .replace("路特斯EL蓝色", "路特斯ELETRE(冰川蓝)").replace("路特斯EL灰色", "路特斯ELETRE(花绽灰)")
                                        .replace("路特斯EV紫色", "路特斯EVIJA(电光紫)").replace("路特斯EV黄色", "路特斯EVIJA(星际黄)")
                                        .replace("兰博轿车金色", "兰博基尼Estoque(炫光金)").replace("兰博轿车尊享铂", "兰博基尼Estoque(尊享铂)")
                                        .replace("兰博轿车灰色", "兰博基尼Estoque(银翼灰)").replace("兰博SVJ炫光金", "兰博基尼Aventador SVJ" +
                                                "(炫光金)")
                                        .replace("兰博SVJ尊享铂", "兰博基尼Aventador SVJ(尊享铂)").replace("兰博SVJ绿色",
                                                "兰博基尼Aventador SVJ(翡翠绿)")
                                        .replace("兰博SUV金色", "兰博基尼URUS(炫光金)").replace("兰博SUV尊享铂", "兰博基尼URUS(尊享铂)")
                                        .replace("兰博SUV黄色", "兰博基尼URUS(明艳黄)").replace("特斯拉R尊享铂", "特斯拉Roadster(尊享铂)")
                                        .replace("特斯拉R沁心粉", "特斯拉Roadster(沁心粉)").replace("特斯拉R水滴蓝", "特斯拉Roadster(水滴蓝)")
                                        .replace("特斯拉C镭光铂", "特斯拉Cybertruck(镭光铂)").replace("特斯拉C荒芜蓝", "特斯拉Cybertruck" +
                                                "(荒芜蓝)")
                                        .replace("特斯拉C极昼黑", "特斯拉Cybertruck(极昼黑)").replace("塞莎深潜蓝", "快艇-塞莎KL27(深潜蓝)")
                                        .replace("塞莎霓虹粉", "快艇-塞莎KL27(霓虹粉)").replace("双刃魅影金色", "双人摩托-双刃魅影(金)")
                                        .replace("双刃魅影红色", "双人摩托-双刃魅影(红)").replace("双刃魅影绿色", "双人摩托-双刃魅影(绿)")
                                        .replace("阿斯顿马丁S金色", "阿斯顿·马丁DBS(金)").replace("阿斯顿马丁S红色", "阿斯顿·马丁DBS(红)")
                                        .replace("阿斯顿马丁S绿色", "阿斯顿·马丁DBS(绿)").replace("阿斯顿马丁X金色", "阿斯顿·马丁DBX(金)")
                                        .replace("阿斯顿马丁X橙色", "阿斯顿·马丁DBX(橙)").replace("阿斯顿马丁X蓝色", "阿斯顿·马丁DBX(蓝)")
                                        .replace("合金龙骨红色", "合金龙骨(红)").replace("合金龙骨蓝色", "合金龙骨(蓝)").replace("合金龙骨绿色",
                                                "合金龙骨(绿)")
                                        .replace("特斯拉3紫色", "特斯拉Model 3(奇幻紫)").replace("特斯拉3银色", "特斯拉Model 3(冷光银)").replace("特斯拉3白色", "特斯拉Model 3(珍珠白)")
                                        .replace("特斯拉X紫色", "特斯拉Model X(奇幻紫)").replace("特斯拉X银色", "特斯拉Model X(冷光银)")
                                        .replace("特斯拉X白色", "特斯拉Model X(珍珠白)").replace("双人摩托梦幻火箭", "双人摩托-梦幻火箭")
                                        .replace("玛莎拉蒂金色", "玛莎拉蒂Ghibli(金)").replace("玛莎拉蒂粉色", "玛莎拉蒂Ghibli(粉)")
                                        .replace("玛莎拉蒂蓝色", "玛莎拉蒂Ghibli(蓝)")
                                        .equals(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("枪械")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF1());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().contains(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("套装")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF5());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                String name = JSONObject.parseObject(p.toString()).getString("name");
                                if (name.contains("-")) {
                                    name = name.split("-")[1];
                                }
                                if (name.equals(gameAttribute1.getFieldName())) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
//                    else {
//                        throw new GlobalException("交易猫套装必传,该账号没有此属性,不推送!!!");
//                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("战备")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF3());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF4());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("飞行器数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF3().split(",").length);
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("载具数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF7());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("粉枪数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF12())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF12());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("枪械数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF9())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF9());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("粉装数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF11());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("套装数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF8())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF8());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("印记数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF16())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF16());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("段位")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF15())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF15()));
                        extProperties.put("value", gameAttribute1.getFieldName());
                    } else {
                        extProperties.put("value", "无");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("热力值")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", 0);
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("商品编号")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", goodsInfoAndAttrValueDto.getId());
                }
                if (Objects.nonNull(extProperties.get("propertyId"))) {
                    list.add(extProperties);
                }
            }
            dataJson.put("extProperties", JSONObject.toJSONString(list));
        }

        if (goodsInfoAndAttrValueDto.getGameName().equals("穿越火线")) {
            dataJson.put("goodsDefTravelContent", "");
            dataJson.put("propertyRecognizeType", "1");
            //服务器
            dataJson.put("keyProperties","[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");

            dataJson.put("description",goodsInfoAndAttrValueDto.getDes().substring(0,50));

            String gameId = "1005668";
            String clientId = "1472625225736942";
            String categoryId = "1702362011919642";

            String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\"5\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";
            String attr = getAttr(data1,salePartner);
            String data = JSONObject.parseObject(attr).getString("data");
            String result = JSONObject.parseObject(data).getString("result");
            String categoryBaseInfo = JSONObject.parseObject(result).getString("categoryBaseInfo");
            String sellerAccountPropertiess = JSONObject.parseObject(result).getString("sellerAccountProperties");
            JSONArray jsonArray2 = JSONArray.parseArray(sellerAccountPropertiess);

            //账号信息
            Map<String, Object> sellerAccountProperties = new HashMap<>();
            List list = new ArrayList<>();
            for (Object o : jsonArray2) {
                sellerAccountProperties = new HashMap<>();
                if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("帐号")) {
                    //"游戏帐号"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", goodsInfoAndAttrValueDto.getAccountNumber().substring(0,goodsInfoAndAttrValueDto.getAccountNumber().length()-2)+ RandomUtil.randomNumbers(2));
                } else if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("密码")) {
                    //"游戏密码"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", String.valueOf(System.currentTimeMillis() / 1000));
                } else {
                    // 手机号码
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", salePartner.getOther());
                }
                list.add(sellerAccountProperties);
            }

            dataJson.put("sellerAccountProperties", JSONObject.toJSONString(list));
            //区服
            dataJson.put("categoryId", "1702362011919642");
            Map<String, Object> gameProperty = new HashMap<>();
            gameProperty.put("gameId", JSONObject.parseObject(categoryBaseInfo).getString("newGameId"));
            gameProperty.put("platformId", JSONObject.parseObject(categoryBaseInfo).getString("platformId"));
            gameProperty.put("clientId", "1472625225736942");
            gameProperty.put("categoryId", "1702362011919642");
            String qufu = "[{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":44,\"id\":1502794170131901,\"isTop\":2,\"name\":\"教育专区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":43,\"id\":1502794170131900,\"isTop\":2,\"name\":\"移动专区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":42,\"id\":1502794134890016,\"isTop\":2,\"name\":\"河南一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":41,\"id\":1502793781464216,\"isTop\":2,\"name\":\"河南二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":40,\"id\":1502793781464213,\"isTop\":2,\"name\":\"北方大区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":39,\"id\":1502793781463212,\"isTop\":2,\"name\":\"山东二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":38,\"id\":1502793781463211,\"isTop\":2,\"name\":\"山东一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":37,\"id\":1502793568305748,\"isTop\":2,\"name\":\"山西一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":36,\"id\":1502793568305747,\"isTop\":2,\"name\":\"河北一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":35,\"id\":1502793568305746,\"isTop\":2,\"name\":\"北京四区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":34,\"id\":1502793568305745,\"isTop\":2,\"name\":\"北京三区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":33,\"id\":1502793568305744,\"isTop\":2,\"name\":\"北京二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":32,\"id\":1502793568305743,\"isTop\":2,\"name\":\"北京一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":31,\"id\":1502793528987110,\"isTop\":2,\"name\":\"黑龙江区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":30,\"id\":1502793528986109,\"isTop\":2,\"name\":\"吉林一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":29,\"id\":1502793528986107,\"isTop\":2,\"name\":\"辽宁三区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":28,\"id\":1502793528986106,\"isTop\":2,\"name\":\"辽宁二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":6,\"id\":1700649125868050,\"name\":\"北部战区\"},\"gameId\":1005668,\"grade\":27,\"id\":1502793528986105,\"isTop\":2,\"name\":\"辽宁一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":26,\"id\":1502793488311854,\"isTop\":2,\"name\":\"江苏二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":25,\"id\":1502793488310852,\"isTop\":2,\"name\":\"江苏一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":4,\"id\":1502793235595617,\"name\":\"西部战区\"},\"gameId\":1005668,\"grade\":24,\"id\":1502793465928256,\"isTop\":2,\"name\":\"云南一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":4,\"id\":1502793235595617,\"name\":\"西部战区\"},\"gameId\":1005668,\"grade\":23,\"id\":1502793465928255,\"isTop\":2,\"name\":\"陕西一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":4,\"id\":1502793235595617,\"name\":\"西部战区\"},\"gameId\":1005668,\"grade\":22,\"id\":1502793465927253,\"isTop\":2,\"name\":\"重庆一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":4,\"id\":1502793235595617,\"name\":\"西部战区\"},\"gameId\":1005668,\"grade\":21,\"id\":1502793465927252,\"isTop\":2,\"name\":\"四川二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":4,\"id\":1502793235595617,\"name\":\"西部战区\"},\"gameId\":1005668,\"grade\":20,\"id\":1502793465927251,\"isTop\":2,\"name\":\"四川一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":19,\"id\":1502793432508973,\"isTop\":2,\"name\":\"安徽一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":18,\"id\":1502793432508972,\"isTop\":2,\"name\":\"福建一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":17,\"id\":1502793432507970,\"isTop\":2,\"name\":\"浙江二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":16,\"id\":1502793432507968,\"isTop\":2,\"name\":\"浙江一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":15,\"id\":1502793432507967,\"isTop\":2,\"name\":\"上海二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":3,\"id\":1502793234271784,\"name\":\"东部战区\"},\"gameId\":1005668,\"grade\":14,\"id\":1502793432507966,\"isTop\":2,\"name\":\"上海一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":13,\"id\":1502793358964061,\"isTop\":2,\"name\":\"南方大区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":12,\"id\":1502793358964059,\"isTop\":2,\"name\":\"江西一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":11,\"id\":1502793358964058,\"isTop\":2,\"name\":\"湖北二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":10,\"id\":1502793358963056,\"isTop\":2,\"name\":\"湖北一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":9,\"id\":1502793358963055,\"isTop\":2,\"name\":\"湖南二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":8,\"id\":1502793358963053,\"isTop\":2,\"name\":\"湖南一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":7,\"id\":1502793115319926,\"isTop\":2,\"name\":\"广西一区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":6,\"id\":1502793115319925,\"isTop\":2,\"name\":\"广东四区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":5,\"id\":1502793115318924,\"isTop\":2,\"name\":\"广东三区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":4,\"id\":1502793115318922,\"isTop\":2,\"name\":\"广东二区\"},{\"domain\":{\"gameId\":1005668,\"grade\":5,\"id\":1700649114604898,\"name\":\"南部战区\"},\"gameId\":1005668,\"grade\":3,\"id\":1502793115318921,\"isTop\":2,\"name\":\"广东一区\"}]\n";
            JSONArray jsonArray = JSONArray.parseArray(qufu);
            for (Object o : jsonArray) {
                if (JSONObject.parseObject(o.toString()).getString("name").equals(goodsInfoAndAttrValueDto.getServerName())) {
                    gameProperty.put("serverId", JSONObject.parseObject(o.toString()).getString("id"));
                    break;
                }
            }
            dataJson.put("gameProperty", JSONObject.toJSONString(gameProperty));

            //属性
            Map<String, Object> extProperties = new HashMap<>();
            String extPropertiess = JSONObject.parseObject(result).getString("extProperties");
            JSONArray jsonArray3 = JSONArray.parseArray(extPropertiess);
            list = new ArrayList<>();
            for (Object o : jsonArray3) {
                extProperties = new HashMap<>();
                extProperties.put("multiSubPropertyInfoList", new ArrayList<>());
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("可二次实名")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                        if (gameAttribute1.getFieldName().equals("有修改机会且实名是本人")) {
                            extProperties.put("value", "可二次实名");
                        } else {
                            extProperties.put("value", "不可二次实名");
                        }
                    } else {
                        extProperties.put("value", "不可二次实名");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("可排位")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF4()));
                        if (gameAttribute1.getFieldName().equals("有")) {
                            extProperties.put("value", "可排位");
                        } else {
                            extProperties.put("value", "不可排位");
                        }
                    } else {
                        extProperties.put("value", "不可排位");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("角色")) {
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF19())) {
                        List<GameAttribute> gameAttributs = getGameAttributs(goodsInfoAndAttrValueDto.getF19());
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        String wuqi = "";
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (onlyHanZi(JSONObject.parseObject(p.toString()).getString("name")).contains(onlyHanZi(gameAttribute1.getFieldName()))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                        if (StringUtils.isNotEmpty(wuqi)) {
                            extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                            extProperties.put("value", wuqi.substring(1));
                        }
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("武器")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF13());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF14());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF15());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF16());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF17());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF18());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (onlyHanZi(JSONObject.parseObject(p.toString()).getString("name")).equals(onlyHanZi(gameAttribute1.getFieldName()))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("传说角色数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11()) ?
                            goodsInfoAndAttrValueDto.getF11() : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("王者角色数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11()) ?
                            goodsInfoAndAttrValueDto.getF11() : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("角色数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF19()) ?
                            goodsInfoAndAttrValueDto.getF19().split(",").length : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("传说武器数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF8()) ?
                            goodsInfoAndAttrValueDto.getF8() : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("王者武器数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF9()) ?
                            goodsInfoAndAttrValueDto.getF9() : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("炫金武器数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF10()) ?
                            goodsInfoAndAttrValueDto.getF10() : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("武器数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF8()) ?
                            goodsInfoAndAttrValueDto.getF8() : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("段位")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF6()));
                        extProperties.put("value", gameAttribute1.getFieldName().replace("未定级", "无"));
                    } else {
                        extProperties.put("value", "无");
                    }
                }
                if (Objects.nonNull(extProperties.get("propertyId"))) {
                    list.add(extProperties);
                }
            }
            dataJson.put("extProperties", JSONObject.toJSONString(list));
        }
        if (goodsInfoAndAttrValueDto.getGameName().equals("火影忍者")) {
            //服务器
            dataJson.put("keyProperties", "[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");

            String gameId = "1003132";
            String clientId = "";
            String categoryId = "";
            String platformId = "";
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if(regional.equals("安卓QQ")) {
                clientId = "1470047031091455";
                categoryId = "1701758897365779";
                platformId = "2";
            }else if(regional.equals("安卓微信")){
                clientId = "1470047033047733";
                categoryId = "1701758936284120";
                platformId = "2";
            }else if(regional.equals("苹果QQ")){
                clientId = "1470047031280559";
                categoryId = "1701759146119683";
                platformId = "3";
            }else {
                clientId = "1499667551454656";
                categoryId = "1701759168345276";
                platformId = "3";
            }

            String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\""+platformId+"\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";

            String attr = getAttr(data1,salePartner);
            String data = JSONObject.parseObject(attr).getString("data");
            String result = JSONObject.parseObject(data).getString("result");
            String categoryBaseInfo = JSONObject.parseObject(result).getString("categoryBaseInfo");
            String sellerAccountPropertiess = JSONObject.parseObject(result).getString("sellerAccountProperties");
            JSONArray jsonArray2 = JSONArray.parseArray(sellerAccountPropertiess);
            //账号信息
            Map<String, Object> sellerAccountProperties = new HashMap<>();
            List list = new ArrayList<>();
            for (Object o : jsonArray2) {
                sellerAccountProperties = new HashMap<>();
                if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("帐号")) {
                    //"游戏帐号"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", goodsInfoAndAttrValueDto.getAccountNumber().substring(0,goodsInfoAndAttrValueDto.getAccountNumber().length()-2)+ RandomUtil.randomNumbers(2));
                } else if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("密码")) {
                    //"游戏密码"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", String.valueOf(System.currentTimeMillis() / 1000));
                } else {
                    // 手机号码
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", salePartner.getOther());
                }
                list.add(sellerAccountProperties);
            }

            dataJson.put("sellerAccountProperties", JSONObject.toJSONString(list));

            //区服
            Map<String, Object> gameProperty = new HashMap<>();
            gameProperty.put("gameId", JSONObject.parseObject(categoryBaseInfo).getString("newGameId"));
            gameProperty.put("platformId", JSONObject.parseObject(categoryBaseInfo).getString("platformId"));
            if (regional.equals("安卓QQ")) {
                gameProperty.put("clientId", "1470047031091455");
                gameProperty.put("categoryId", "1701758897365779");
                dataJson.put("categoryId", "1701758897365779");
                gameProperty.put("serverId", "821943");
            } else if (regional.equals("安卓微信")) {
                gameProperty.put("clientId", "1470047033047733");
                gameProperty.put("categoryId", "1701758936284120");
                dataJson.put("categoryId", "1701758936284120");
                gameProperty.put("serverId", "1515759538110230");
            } else if (regional.equals("苹果QQ")) {
                gameProperty.put("clientId", "1470047031280559");
                gameProperty.put("categoryId", "1701759146119683");
                dataJson.put("categoryId", "1701759146119683");
                gameProperty.put("serverId", "821943");
            } else {
                gameProperty.put("clientId", "1499667551454656");
                gameProperty.put("categoryId", "1701759168345276");
                dataJson.put("categoryId", "1701759168345276");
                gameProperty.put("serverId", "1515759538110230");
            }
            dataJson.put("gameProperty", JSONObject.toJSONString(gameProperty));

            //属性
            Map<String, Object> extProperties = new HashMap<>();
            String extPropertiess = JSONObject.parseObject(result).getString("extProperties");
            JSONArray jsonArray3 = JSONArray.parseArray(extPropertiess);
            list = new ArrayList<>();
            for (Object o : jsonArray3) {
                extProperties = new HashMap<>();
                extProperties.put("multiSubPropertyInfoList", new ArrayList<>());
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("可二次实名")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF7()));
                        if (gameAttribute1.getFieldName().equals("可改二次")) {
                            extProperties.put("value", "可二次实名");
                        } else {
                            extProperties.put("value", "不可二次实名");
                        }
                    } else {
                        extProperties.put("value", "不可二次实名");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("忍者")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF5());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF6());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    String wuqi = "";
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                if (gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("name"))) {
                                    wuqi += "," + JSONObject.parseObject(p.toString()).getString("name");
                                }
                            }
                        }
                    }
                    if (StringUtils.isNotEmpty(wuqi)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", wuqi.substring(1));
                    }
//                    else {
//                        throw new GlobalException("交易猫忍者必传,该账号没有此属性,不推送!!!");
//                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("S忍数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF1());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("A忍数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                        extProperties.put("value", goodsInfoAndAttrValueDto.getF2());
                    } else {
                        extProperties.put("value", 0);
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("S碎片数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", 0);
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("忍者数")) {
                    int number = 0;
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                        number = number + Integer.parseInt(goodsInfoAndAttrValueDto.getF1());
                    }
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                        number = number + Integer.parseInt(goodsInfoAndAttrValueDto.getF2());
                    }
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", number);
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("通灵数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", 0);
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("战力")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "100W内");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("排名")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "无");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("VIP等级")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                        GameAttribute gameAttribute1 =
                                gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                        extProperties.put("value", gameAttribute1.getFieldName().replace("V", "").replace("无", "1"));
                    } else {
                        extProperties.put("value", "1");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("段位")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "无");
                }
                if (Objects.nonNull(extProperties.get("propertyId"))) {
                    list.add(extProperties);
                }
            }
            dataJson.put("extProperties", JSONObject.toJSONString(list));
        }
        if (goodsInfoAndAttrValueDto.getGameName().equals("无畏契约")) {
            dataJson.put("goodsDefTravelContent", "");
            dataJson.put("propertyRecognizeType", "1");
            //服务器
            dataJson.put("keyProperties","[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");

            dataJson.put("description",goodsInfoAndAttrValueDto.getDes().substring(0,50));

            String gameId = "2000595";
            String clientId = "1472625225736942";
            String categoryId = "1701757488714827";
            if(goodsInfoAndAttrValueDto.getCarrierName().contains("微信")) {
                throw new GlobalException("微信区暂时对接不了!");
            }

            String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\"5\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";
            String attr = getAttr(data1,salePartner);
            String data = JSONObject.parseObject(attr).getString("data");
            String result = JSONObject.parseObject(data).getString("result");
            String categoryBaseInfo = JSONObject.parseObject(result).getString("categoryBaseInfo");
            String sellerAccountPropertiess = JSONObject.parseObject(result).getString("sellerAccountProperties");
            JSONArray jsonArray2 = JSONArray.parseArray(sellerAccountPropertiess);
            //账号信息
            Map<String, Object> sellerAccountProperties = new HashMap<>();
            List list = new ArrayList<>();
            for (Object o : jsonArray2) {
                sellerAccountProperties = new HashMap<>();
                if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("帐号")) {
                    //"游戏帐号"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    sellerAccountProperties.put("value", goodsInfoAndAttrValueDto.getAccountNumber().substring(0,goodsInfoAndAttrValueDto.getAccountNumber().length()-2)+ RandomUtil.randomNumbers(2));
                } else if (JSONObject.parseObject(o.toString()).getString("propertyName").contains("密码")) {
                    //"游戏密码"
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", String.valueOf(System.currentTimeMillis() / 1000));
                } else {
                    // 手机号码
                    sellerAccountProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString(
                            "propertyId"));
                    sellerAccountProperties.put("value", salePartner.getOther());
                }
                list.add(sellerAccountProperties);
            }
            dataJson.put("sellerAccountProperties", JSONObject.toJSONString(list));

            //区服
            dataJson.put("categoryId", "1701757488714827");
            Map<String, Object> gameProperty = new HashMap<>();
            gameProperty.put("gameId", JSONObject.parseObject(categoryBaseInfo).getString("newGameId"));
            gameProperty.put("platformId", JSONObject.parseObject(categoryBaseInfo).getString("platformId"));
            gameProperty.put("clientId", "1472625225736942");
            gameProperty.put("categoryId", "1701757488714827");
            gameProperty.put("serverId", "1688115777354488");
            dataJson.put("gameProperty", JSONObject.toJSONString(gameProperty));

            //属性
            Map<String, Object> extProperties = new HashMap<>();
            String extPropertiess = JSONObject.parseObject(result).getString("extProperties");
            JSONArray jsonArray3 = JSONArray.parseArray(extPropertiess);
            list = new ArrayList<>();
            for (Object o : jsonArray3) {
                extProperties = new HashMap<>();
                extProperties.put("multiSubPropertyInfoList", new ArrayList<>());
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("可二次实名")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
                        if (gameAttribute1.getFieldName().equals("可二次实名")) {
                            extProperties.put("value", "可二次实名");
                        } else {
                            extProperties.put("value", "不可二次实名");
                        }
                    } else {
                        extProperties.put("value", "不可二次实名");
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤")) {
                    String pfIds = "";
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF2());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF3());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF4());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF5());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF6());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF7());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF8());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF9());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF10());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF11());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF12());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF13());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF14());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF15());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF16());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF17());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF18());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF19());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF20());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF21());
                    pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF22());
                    List<GameAttribute> gameAttributs = getGameAttributs(pfIds);
                    Set<String> pflist = new LinkedHashSet<>();
                    if (CollectionUtils.isNotEmpty(gameAttributs)) {
                        String options = JSONObject.parseObject(o.toString()).getString("options");
                        JSONArray jsonArray1 = JSONArray.parseArray(options);
                        for (GameAttribute gameAttribute1 : gameAttributs) {
                            for (Object p : jsonArray1) {
                                String string = JSONObject.parseObject(p.toString()).getString("name");
                                if(string.contains(" ")){
                                    string = string.split(" ")[0];
                                }
                                if (gameAttribute1.getFieldName().contains(string)) {
                                    pflist.add(JSONObject.parseObject(p.toString()).getString("name"));
                                }
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(pflist)) {
                        extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                        extProperties.put("value", pflist.stream().collect(Collectors.joining(",")));
                    }
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("限定皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF26()) ? goodsInfoAndAttrValueDto.getF26() : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("尊爵皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF24()) ? goodsInfoAndAttrValueDto.getF24() : "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value","0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("英雄数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value","0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("卡面数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value","0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("已用无畏点")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("已用源晶点")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "0");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("段位")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", "无");
                }
                if (JSONObject.parseObject(o.toString()).getString("propertyName").equals("究极皮肤数")) {
                    extProperties.put("propertyId", JSONObject.parseObject(o.toString()).getString("propertyId"));
                    extProperties.put("value", StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF25()) ? goodsInfoAndAttrValueDto.getF25() : "0");
                }
                if (Objects.nonNull(extProperties.get("propertyId"))) {
                    list.add(extProperties);
                }
            }
            dataJson.put("extProperties", JSONObject.toJSONString(list));
        }
        String data = dataJson.toJSONString();
        return data;
    }


    private String guolvDes(String des) {
        SysDictData sysDictData = new SysDictData();
        sysDictData.setDictType("jym_check");
        sysDictData.setStatus(Constants.STR_0);
        List<SysDictData> sysDictDataList = sysDictDataMapper.selectDictDataList(sysDictData);
        for (SysDictData dictData : sysDictDataList) {
            String value = dictData.getDictValue();
            if (des.contains(value)) {
                des = des.replace(value, "");
            }
        }
        return des;
    }

    //只保留中文
    private String onlyHanZi(String str) {
        String reg = "[^\u4e00-\u9fa5]";
        str = str.replaceAll(reg, "");
        return str;
    }


    //    static String jymId = "jym01317119511695041036456854811548972007011d6c7239d4ffc293a441b19e922db";
    static String umidToken = "T2gABPVeO-alcCkOweYX3vXBnIkpQ0OuDLAU-bBTXpRz_0a72ApQHrgMr1PAe3xI9ps=";

    public static void main(String[] args) {

//        String gameId = "1006473";
//        String clientId = "1470047031091455";
//        String categoryId = "1702277118311394";
//        String data1 = "{\"gameId\":\""+gameId+"\",\"clientId\":\""+clientId+"\",\"platformId\":\"2\",\"categoryId\":\""+categoryId+"\",\"isEdit\":false}";
        SalePartner salePartner = new SalePartner();
        salePartner.setSaleKey("pt1040055wc032269c8gt449vzxkj94uxf7pq42f3o");
//        String attr = getAttr(data1,salePartner);
//        System.out.println(attr);
        String data = "{\"categoryId\":\"1719886237225367\",\"gameAccount\":\"46422347\",\"serverId\":1517384142749498}";
//        String data = "{\"taskId\":\"7244607222059500044\"}";
        String ewm = getEWM(data, salePartner);
        System.out.println(ewm);
    }

    static String getEWMdel(String data,SalePartner salePartner){
        HttpResponse response = getToken();
        //获取到token
        HttpCookie m_h5_tk = response.getCookie("_m_h5_tk");
        String _m_h5_tk = m_h5_tk.getValue();
        HttpCookie m_h5_tk_enc = response.getCookie("_m_h5_tk_enc");
        String _m_h5_tk_enc = m_h5_tk_enc.getValue();
        String cookie = JiaoYiMaoAttrUtil.getCookie(_m_h5_tk, _m_h5_tk_enc, salePartner.getSaleKey());

        String jsv = "2.7.2";
        String appKey = "12574478";
        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(System.currentTimeMillis());
        System.out.println(t);
        StringBuffer query = new StringBuffer();


        query.append(token).append("&").append(t).append("&").append(appKey).append("&").append(JSONObject.parseObject(data).toJSONString());

        String sign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post("https://mtop.jiaoyimao.com/h5/mtop.jym.jymgoods.goods.autorecognizeproperty.deleteqrrecord/1.0/")
                .form("data", JSONObject.parseObject(data))
                .form("jsv", jsv)
                .form("appKey", appKey)
                .form("t", t)
                .form("sign", sign)
                .header("cookie", cookie)
                .execute();
        String body = rawResponse.body();
        return body;
    }

    static String getEWM1(String data,SalePartner salePartner){
        HttpResponse response = getToken();
        //获取到token
        HttpCookie m_h5_tk = response.getCookie("_m_h5_tk");
        String _m_h5_tk = m_h5_tk.getValue();
        HttpCookie m_h5_tk_enc = response.getCookie("_m_h5_tk_enc");
        String _m_h5_tk_enc = m_h5_tk_enc.getValue();
        String cookie = JiaoYiMaoAttrUtil.getCookie(_m_h5_tk, _m_h5_tk_enc, salePartner.getSaleKey());

        String jsv = "2.7.2";
        String appKey = "12574478";
        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(System.currentTimeMillis());
        System.out.println(t);
        StringBuffer query = new StringBuffer();


        query.append(token).append("&").append(t).append("&").append(appKey).append("&").append(JSONObject.parseObject(data).toJSONString());

        String sign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post("https://mtop.jiaoyimao.com/h5/mtop.jym.jymgoods.goods.autorecognizeproperty.getqrrecognizeinfo/1.0/")
                .form("data", JSONObject.parseObject(data))
                .form("jsv", jsv)
                .form("appKey", appKey)
                .form("t", t)
                .form("sign", sign)
                .header("cookie", cookie)
                .execute();
        String body = rawResponse.body();
        return body;
    }

    static String getEWM(String data,SalePartner salePartner){
        HttpResponse response = getToken();
        //获取到token
        HttpCookie m_h5_tk = response.getCookie("_m_h5_tk");
        String _m_h5_tk = m_h5_tk.getValue();
        HttpCookie m_h5_tk_enc = response.getCookie("_m_h5_tk_enc");
        String _m_h5_tk_enc = m_h5_tk_enc.getValue();
        String cookie = JiaoYiMaoAttrUtil.getCookie(_m_h5_tk, _m_h5_tk_enc, salePartner.getSaleKey());

        String jsv = "2.7.2";
        String appKey = "12574478";
        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(System.currentTimeMillis());
        System.out.println(t);
        StringBuffer query = new StringBuffer();


        query.append(token).append("&").append(t).append("&").append(appKey).append("&").append(JSONObject.parseObject(data).toJSONString());

        String sign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post("https://mtop.jiaoyimao.com/h5/mtop.jym.jymgoods.goods.autorecognizeproperty.applyqrrecognize/1.0/")
                .form("data", JSONObject.parseObject(data))
                .form("jsv", jsv)
                .form("appKey", appKey)
                .form("t", t)
                .form("sign", sign)
                .header("cookie", cookie)
                .execute();
        String body = rawResponse.body();
        return body;
    }

    static String getAttr(String data,SalePartner salePartner){
        HttpResponse response = getToken();
        //获取到token
        HttpCookie m_h5_tk = response.getCookie("_m_h5_tk");
        String _m_h5_tk = m_h5_tk.getValue();
        HttpCookie m_h5_tk_enc = response.getCookie("_m_h5_tk_enc");
        String _m_h5_tk_enc = m_h5_tk_enc.getValue();
        String cookie = JiaoYiMaoAttrUtil.getCookie(_m_h5_tk, _m_h5_tk_enc, salePartner.getSaleKey());

        String jsv = "2.7.2";
        String appKey = "12574478";
        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());
        StringBuffer query = new StringBuffer();


        query.append(token).append("&").append(t).append("&").append(appKey).append("&").append(JSONObject.parseObject(data).toJSONString());

        String sign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post("https://mtop.jiaoyimao.com/h5/mtop.jym.jymgoods.goods.core.getgoodsdefforpc/1.0/")
                .form("data", JSONObject.parseObject(data))
                .form("jsv", jsv)
                .form("appKey", appKey)
                .form("t", t)
                .form("sign", sign)
//                .form("dataType", "json")
//                .form("valueType", "original")
//                .form("api", "mtop.jym.jymgoods.goods.autoRecognizeProperty.recognizeProperty")
//                .form("v", "1.0")
//                .form("type", "originaljson")
//                .form("preventFallback", "true")
//                .header("authority", "mtop.jiaoyimao.com")
//                .header("accept", "application/json")
//                .header("content-type", "application/x-www-form-urlencoded")
//                .header("jym-session-id", str)
//                .header("sec-ch-ua-platform", "Windows")
//                .header("origin", "https://www.jiaoyimao.com")
//                .header("sec-fetch-site", "same-site")
//                .header("sec-fetch-mode", "cors")
//                .header("sec-fetch-dest", "empty")
//                .header("referer", "https://www.jiaoyimao.com/")
                .header("cookie", cookie)
                .execute();
        String body = rawResponse.body();
        return body;
    }


    /**
     * 全部下架
     */
    static void bacthDown(String cookie, String _m_h5_tk) {

        boolean b = true;
        while (b) {
            JSONObject jsonObject = JSONObject.parseObject(list(cookie, _m_h5_tk).body());
            System.out.println(jsonObject.toJSONString());
            JSONObject data1 = jsonObject.getJSONObject("data");

            JSONObject result = data1.getJSONObject("result");
            String goodsList = result.getString("goodsList");
            List<JSONObject> jsonObjects = JSONArray.parseArray(goodsList, JSONObject.class);
            if (jsonObjects.size() < 1) {
                b = false;
            } else {
                for (JSONObject object : jsonObjects) {
                    String goodsId = object.getString("goodsId");
                    down(cookie, _m_h5_tk, goodsId);
                }
            }

        }
    }


    private static HttpResponse list(String cookie, String _m_h5_tk) {
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.jymsell.item.mng.h5.getlistpage/1.0/";

        String jsv = "2.6.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();

        String data = "{\"page\":3,\"context\":\"{\\\"appendDraftToOnHoldList\\\":false}\"," +
                "\"cateStatus\":\"cateonsold\"}";
//        String data = "{\"page\":1,\"cateStatus\":\"cateaudit\"}";
        log.info(data);
        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data", data)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("sign", "27a56eee6779b8ce0d1db49dba982c5b")
                .form("dataType", "json")
                .form("valueType", "original")
                .form("api", "mtop.jym.jymsell.item.mng.h5.getListPage")
                .form("v", "1.0")
                .form("type", "originaljson")
                .form("ttid", "jym_001@chrome_android_124.0.0.0_jiaoyimao")
                .form("preventFallback", "true")
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"2431715334020447\",\"ssids\":\"2431715334020447\"," +
                        "\"ch\":\"10438\",\"plat\":\"JYM_ANDROID_TOUCH\",\"platform\":\"JYM_ANDROID_TOUCH\"," +
                        "\"terminal\":\"android\",\"osCode\":\"android\",\"chCode\":\"h5\",\"ieuAppCode\":\"\"}")
                .header("cookie", cookie)
                .execute();
        return rawResponse;
    }

    /**
     * 编辑  只能改价
     */
    static void edit(String cookie, String _m_h5_tk) {
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.com.jym.security.core.sendriskevent/1.0/";

        String jsv = "2.6.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();

        //改价的时候传入商品ID 和 价格
        String goodsId = "1709104295550599";
        String last_price = "1330";

        String data = "{\"eventCode\":\"game_gamecat_prod_updprice\",\"bizScene\":\"game_gamecat_prod_updprice\"," +
                "\"dataCtx\":\"{\"sub_scene\":\"FrontedGoodsUpdatePrice\",\"last_price\":\"" + last_price + "\"}\"," +
                "\"goodsId\": " + goodsId + "}";
        log.info(data);
        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data", data)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"4461709102075386\",\"ssids\":\"4461709102075386\"," +
                        "\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\"," +
                        "\"terminal\":\"ios\"," +
                        "\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();

        log.info(rawResponse.body());
    }


    /**
     * 下架
     */
    static String down(String cookie, String _m_h5_tk, String goods_id) {
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.jymsell.item.mng.h5.updatestatus/1.0";

        String jsv = "2.6.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        //下架的时候传入商品ID

        //先查询 recordId
        String highRiskUserRecognitionuRL = "https://m.jiaoyimao.com/api2/user/highRiskUserRecognition";
        JSONObject highJson = new JSONObject();
        highJson.put("recordId", "");
        highJson.put("scene", "game_gamecat_prod_offsale");
        highJson.put("umidToken", "");
        JSONObject extraPrams = new JSONObject();
        extraPrams.put("p_id_desc", 1);
        extraPrams.put("category_name", "");
        extraPrams.put("game_name", "");
        extraPrams.put("goods_id", goods_id);
        extraPrams.put("ori_price", "");
        highJson.put("extraPrams", extraPrams);
        highJson.put("version", 1);
        log.info(highJson.toJSONString());


        HttpResponse highRiskUserRes = HttpRequest.post(highRiskUserRecognitionuRL)
                .body(highJson.toJSONString())
                .header("content-type", "application/json")
                .header("cookie", cookie)
                .header("referer", "https://m.jiaoyimao.com/rx/goods/manage.html")
                .execute();
        String body = highRiskUserRes.body();

        String recordId = "";
        JSONObject jsonObject = JSONObject.parseObject(body);
        if (Objects.equals(jsonObject.getInteger("stateCode"), 200)) {
            JSONObject data = jsonObject.getJSONObject("data");
            JSONObject result = data.getJSONObject("result");
            recordId = result.getString("recordId");
        }

        StringBuffer query = new StringBuffer();

        JSONObject data = new JSONObject();
        data.put("itemId", goods_id);
        data.put("action", "offsoldgoods");
        data.put("recordId", recordId);

        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data.toJSONString());
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data", data.toJSONString())
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"5611709604019339\",\"ssids\":\"5611709604019339\"," +
                        "\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\"," +
                        "\"terminal\":\"ios\"," +
                        "\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();

        return rawResponse.body();
    }

    /**
     * 撤回
     */
    static String withdraw(String cookie, String _m_h5_tk, String goodsId) {
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.jymsell.item.mng.h5.updatestatus/1.0/";

        String jsv = "2.6.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();

        //撤回的时候传入商品ID   下架账号之后 都要先调一下撤回

        JSONObject data = new JSONObject();
        data.put("itemId", goodsId);
        data.put("action", "cancelaudit");

        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data.toJSONString());
        String algSign = DigestUtils.md5Hex(query.toString());
        log.info(algSign);
        log.info(t);
        log.info(cookie);
        String rawResponse = HttpRequest.post(baseUrl)
                .form("data", data.toJSONString())
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"4461709102075386\",\"ssids\":\"4461709102075386\"," +
                        "\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\"," +
                        "\"terminal\":\"ios\"," +
                        "\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute().body();
        return rawResponse;
    }

    /**
     * imgResultId 图片上传返回ID
     *
     * @param cookie
     * @param _m_h5_tk
     * @param imgResultId
     */
    static void add(String cookie, String _m_h5_tk, String imgResultId, String imageListStr) {

        //解析

        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.jymsell.item.publish.pc.publishiteminpc/1.0/";

//        JSONObject data = buildParams("王者荣耀");

//        String data = "{\"title\":\"商品标题将由系统生成\",\"image:" + imageListStr + ",description\":\"不玩了\",
//        \"price\":\"5666\",\"storage\":\"1\",\"_protocol\":\"true\",
//        \"extProperties\":\"[{\"propertyId\":1692936077560217,\"value\":\"可二次实名\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077747261,\"value\":\"111\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936074296581,\"value\":\"王者之心,王者之影\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077767265,\"value\":\"甄梦,斯薇特-X\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936074282577,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936074289580,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077552216,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077580220,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077587223,\"value\":\"精英\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936074259574,\"value\":\"1\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077760263,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1696746305384261,\"value\":\"王者之翼-紫电熔岩,王者之魄-紫电熔岩\",\"multiSubPropertyInfoList\":[]}]\",
//        \"sellerAccountProperties\":\"[{\"propertyId\":1692936074144544,\"value\":\"1343851255\"},
//        {\"propertyId\":1692936074175553,\"value\":\"qwer1234\"},{\"propertyId\":1692936077753262,
//        \"value\":\"15236094868\"}]\",\"gameProperty\":\"{\"gameId\":\"1002600\",\"clientId\":\"1470047031091455\",
//        \"platformId\":\"2\",\"categoryId\":\"1692936074107541\",\"serverId\":680750}\",
//        \"keyProperties\":\"[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]\",
//        \"modelType\":\"pc\",\"categoryId\":\"1692936074107541\",
//        \"goodsDefTravelContent\":\"{\"forceBargain\":true}\",\"addlService\":\"{\"supportBargain\":false}\",
//        \"priceYuan\":\"5666\",\"imageIdListStr:"+imgResultId + ",propertyRecognizeType\":\"0\"}";

//        String data = "{\"title\":\"商品标题将由系统生成\",\"image\":\"[{\"url\":\"https://static-cdn.jiaoyimao
//        .com/jym-oss/resource/item/1685196620085637/20240327/7773173425da4ceea74709ea4092a667.jpg\",
//        \"onlinePath\":\"/jym-oss/resource/item/1685196620085637/20240327/7773173425da4ceea74709ea4092a667
        //        .jpg\"}]\",\"description\":\"不玩了\",\"price\":\"5666\",\"storage\":\"1\",\"_protocol\":\"true\",
//        \"extProperties\":\"[{\"propertyId\":1692936077560217,\"value\":\"可二次实名\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077747261,\"value\":\"111\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936074296581,\"value\":\"王者之心,王者之影\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077767265,\"value\":\"甄梦,斯薇特-X\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936074282577,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936074289580,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077552216,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077580220,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077587223,\"value\":\"精英\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936074259574,\"value\":\"1\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1692936077760263,\"value\":\"11\",\"multiSubPropertyInfoList\":[]},
//        {\"propertyId\":1696746305384261,\"value\":\"王者之翼-紫电熔岩,王者之魄-紫电熔岩\",\"multiSubPropertyInfoList\":[]}]\",
//        \"sellerAccountProperties\":\"[{\"propertyId\":1692936074144544,\"value\":\"1343851266\"},
//        {\"propertyId\":1692936074175553,\"value\":\"qwer1234\"},{\"propertyId\":1692936077753262,
//        \"value\":\"15236094868\"}]\",\"gameProperty\":\"{\"gameId\":\"1002600\",\"clientId\":\"1470047031091455\",
//        \"platformId\":\"2\",\"categoryId\":\"1692936074107541\",\"serverId\":680750}\",
//        \"keyProperties\":\"[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]\",
//        \"modelType\":\"pc\",\"categoryId\":\"1692936074107541\",
//        \"goodsDefTravelContent\":\"{\"forceBargain\":true}\",\"addlService\":\"{\"supportBargain\":false}\",
//        \"priceYuan\":\"5666\",\"imageIdListStr\":\"7178693400255162888\",\"propertyRecognizeType\":\"0\"}";

        JSONObject dataJson = new JSONObject();
        dataJson.put("title", "商品标题将由系统生成");
        dataJson.put("image", imageListStr);
        dataJson.put("description", "不玩了");
        dataJson.put("price", "5666");
        dataJson.put("storage", "1");
        dataJson.put("_protocol", "true");
        dataJson.put("extProperties", "[{\"propertyId\":1692936077560217,\"value\":\"可二次实名\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936077747261,\"value\":\"111\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936074296581,\"value\":\"王者之心,王者之影\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936077767265,\"value\":\"甄梦,斯薇特-X\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936074282577,\"value\":\"11\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936074289580,\"value\":\"11\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936077552216,\"value\":\"11\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936077580220,\"value\":\"11\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936077587223,\"value\":\"精英\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936074259574,\"value\":\"1\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1692936077760263,\"value\":\"11\"," +
                "\"multiSubPropertyInfoList\":[]},{\"propertyId\":1696746305384261,\"value\":\"王者之翼-紫电熔岩," +
                "王者之魄-紫电熔岩\",\"multiSubPropertyInfoList\":[]}]");
        dataJson.put("sellerAccountProperties", "[{\"propertyId\":1692936074144544,\"value\":\"1343851255\"}," +
                "{\"propertyId\":1692936074175553,\"value\":\"qwer1234\"},{\"propertyId\":1692936077753262," +
                "\"value\":\"15236094868\"}]");
        dataJson.put("gameProperty", "{\"gameId\":\"1002600\",\"clientId\":\"1470047031091455\",\"platformId\":\"2\"," +
                "\"categoryId\":\"1692936074107541\",\"serverId\":680750}");
        dataJson.put("keyProperties", "[{\"tags\":[{\"tagCode\":\"gameServer\"}],\"propertyName\":\"服务器\"}]");
        dataJson.put("modelType", "pc");
        dataJson.put("categoryId", "1692936074107541");
        dataJson.put("goodsDefTravelContent", "{\"forceBargain\":true}");
        dataJson.put("addlService", "{\"supportBargain\":false}");
        dataJson.put("priceYuan", "5666");
        dataJson.put("imageIdListStr", imgResultId);
        dataJson.put("propertyRecognizeType", "0");
        String data = dataJson.toJSONString();
        log.info("data={}", data);

        String jsv = "2.7.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();

        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data", data)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .form("dataType", "json")
                .form("valueType", "original")
                .form("api", "mtop.jym.jymsell.item.publish.pc.publishItemInPc")
                .form("v", "1.0")
                .form("type", "originaljson")
                .form("preventFallback", "true")
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"4461709102075386\",\"ssids\":\"4461709102075386\"," +
                        "\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\"," +
                        "\"terminal\":\"ios\"," +
                        "\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();
        String body = rawResponse.body();
        log.info(body);
    }

    Map<String, Object> imgUpload(String cookie, String _m_h5_tk, String imgUrls) {
        String imageIdListStr = new String();
        List<Map<String, Object>> images = new ArrayList<>();
        Map<String, Object> imgMap = new HashMap<>();

        String jsv = "2.7.2";
        String appKey = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        //文件名称
        String[] imgs = imgUrls.split(",");
        List<String> list = Arrays.asList(imgs);
//        if (list.size() > 3) {
//            list = list.subList(0, 3);
//        }
        for (String img : list) {
            StringBuffer query = new StringBuffer();
            JSONObject data = new JSONObject();
            data.put("bizId", "1");
            String fieldName = img.substring(img.lastIndexOf("/") + 1);
            data.put("fileName", fieldName);

//        String data = "{\"bizId\":\"1\",\"fileName\":\"2c97e7c98e5f3329018e65763ab50c6b.jpg\"}";

            //获取交易猫图片上传 密钥
            String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.fileserver.applyfileupload/1.0/";
            query.append(token).append("&").append(t).append("&").append(appKey).append("&").append(data);
            String algSign = DigestUtils.md5Hex(query.toString());
            Map<String, Object> params = new HashMap<>();
            Map<String, Object> header = new HashMap<>();
            header.put("Cookie", cookie);
            params.put("data", data.toJSONString());
            params.put("appKey", appKey);
            params.put("t", t);
            params.put("sign", algSign);
            String s = HttpUtils.doPostForm(baseUrl, params, header);
            JSONObject jsonObject = JSONObject.parseObject(s);
            JSONObject data1 = jsonObject.getJSONObject("data");
            JSONObject result = data1.getJSONObject("result");
            JSONObject credentials = result.getJSONObject("credentials");
            String securityToken = credentials.getString("securityToken");
            String accessKeyId = credentials.getString("accessKeyId");
            String accessKeySecret = credentials.getString("accessKeySecret");

            String env = result.getString("pathList");
            List<String> stringList = JSONArray.parseArray(env, String.class);
            String path = stringList.get(0);

            URL url = null;
            byte[] bytes = {};
            try {
                url = new URL(img);
                BufferedImage bufferedImage = ImageIO.read(url.openStream());
                bytes = ImgUntil.bufferedImageToByteArray(bufferedImage);
                //如果是多图片，这里要循环上传图片，最好不要超过五张
                uoload(accessKeyId, accessKeySecret, securityToken, bytes, path);
                //验证图片
                //获取resultId，如果是多张图片 循环往 goodsImageDTOListStr 添加
                List<JSONObject> goodsImageDTOListStr = new ArrayList<>();
                JSONObject goodsImgeDto = new JSONObject();
                goodsImgeDto.put("originImage", "/" + path);
                goodsImgeDto.put("wapThumbnail", "/" + path);
                goodsImgeDto.put("pcThumbnail", "/" + path);
                goodsImgeDto.put("auditImage", "/" + path);
                goodsImageDTOListStr.add(goodsImgeDto);
                JSONObject goodsImageDTOParams = new JSONObject();
                goodsImageDTOParams.put("goodsImageDTOListStr", goodsImageDTOListStr.toString());
                String imgeResultId = getImgeResultId(goodsImageDTOParams.toString(), cookie, _m_h5_tk);


                //add图片上传参数
                //解析imgeResultId
                JSONObject jsonObject1 = JSONObject.parseObject(imgeResultId);
                JSONObject resdata = jsonObject1.getJSONObject("data");
                String result1 = resdata.getString("result");
                List<String> stringList1 = JSONObject.parseArray(result1, String.class);
                imageIdListStr += "," + StringUtils.join(stringList1, ",");
                //https://static-cdn.jiaoyimao.com/jym-oss/resource/item/1685196620085637/20240327
                // /7773173425da4ceea74709ea4092a667.jpg
                //童谣如果是多张图片 这也也是循环往images添加
                String baseDomain = "https://static-cdn.jiaoyimao.com/";
                JSONObject image = new JSONObject();
                image.put("url", baseDomain + path);
                image.put("onlinePath", "/" + path);
                images.add(image);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        imgMap.put("images", images);
        imgMap.put("imageIdListStr", imageIdListStr.substring(1));
        return imgMap;
    }


    static String getImgeResultId(String data, String cookie, String _m_h5_tk) {
        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.jym.jymgoods.goods.publish.addimagerecordlistformtop/1.0/";

        String jsv = "2.7.2";
        String s = "12574478";

        String token = _m_h5_tk.split("_")[0];
        String t = String.valueOf(new Date().getTime());

        StringBuffer query = new StringBuffer();
//        String data = "{\"goodsImageDTOListStr\":[\"[{\"originImage\":\"/jym-oss/resource/item/1685196620085637
//        /20240326/044fdd3a13e54afc8b868246e6112d34.jpg\",
//        \"wapThumbnail\":\"/jym-oss/resource/item/1685196620085637/20240326/044fdd3a13e54afc8b868246e6112d34.jpg\",
//        \"pcThumbnail\":\"/jym-oss/resource/item/1685196620085637/20240326/044fdd3a13e54afc8b868246e6112d34.jpg\",
//        \"auditImage\":\"/jym-oss/resource/item/1685196620085637/20240326/044fdd3a13e54afc8b868246e6112d34.jpg\"},
//        {\"originImage\":\"/jym-oss/resource/item/1685196620085637/20240326/830591fc73214b21adba7c88f862746d.jpg\",
//        \"wapThumbnail\":\"/jym-oss/resource/item/1685196620085637/20240326/830591fc73214b21adba7c88f862746d.jpg\",
//        \"pcThumbnail\":\"/jym-oss/resource/item/1685196620085637/20240326/830591fc73214b21adba7c88f862746d.jpg\",
//        \"auditImage\":\"/jym-oss/resource/item/1685196620085637/20240326/830591fc73214b21adba7c88f862746d
//        .jpg\"}]\"]}";
        log.info("data={}", data);
        //撤回的时候传入商品ID   下架账号之后 都要先调一下撤回
        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse rawResponse = HttpRequest.post(baseUrl)
                .form("data", data)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .form("dataType", "json")
                .form("valueType", "original")
                .form("api", "top.jym.jymgoods.goods.publish.addImageRecordListForMtop")
                .form("v", "1.0")
                .form("type", "originaljson")
                .form("preventFallback", "true")
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"4461709102075386\",\"ssids\":\"4461709102075386\"," +
                        "\"ch\":\"10438\",\"plat\":\"JYM_IOS_TOUCH\",\"platform\":\"JYM_IOS_TOUCH\"," +
                        "\"terminal\":\"ios\"," +
                        "\"osCode\":\"ios\",\"chCode\":\"h5\"}")
                .header("cookie", cookie)
                .execute();
        String body = rawResponse.body();
        log.info("获取图片返回结果ID={}", body);
        return body;
    }

//    static void add(String cookie){
//
//
//        String baseUrl = "https://m.jiaoyimao.com/api2/sellerPublish/createGoods";
//
//        JSONObject data = buildParams("王者荣耀");
//
//        log.info(data.toJSONString());
//        HttpResponse createGoodsresponse = HttpRequest.post(baseUrl).body(data.toJSONString())
//                .header("authority", "mtop.jiaoyimao.com")
//                .header("accept", "application/json")
//                .header("content-type", "application/json")
//                .header("origin", "https://m.jiaoyimao.com")
//                .header("referer", "https://m.jiaoyimao
//                .com/newPublish?type=normal&categoryId=1642580017608072&isSmartPublish=0&clientId=1470047031280559
//                &platformId=3")
//                .header("sec-fetch-dest", "empty")
//                .header("sec-fetch-mode", "cors")
//                .header("user-agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15
//                (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1")
//                .header("sec-fetch-site", "same-origin")
//                .header("bx-v", "2.2.3")
//                .header("cookie", cookie)
//                .execute();
//        log.info(createGoodsresponse.body());
//    }


    static JSONObject buildParams(String gameType) {

        JSONObject result = new JSONObject();

        /**
         * 这里以王者荣耀做的数据拼装案例
         *
         */
        if (Objects.equals("王者荣耀", gameType)) {
            List<JSONObject> keyProperties = new ArrayList<>();
            JSONObject keyPropertie = new JSONObject();
            keyPropertie.put("propertyName", "服务器");
            keyPropertie.put("defaultValue", 1498479938499394l);

            List<JSONObject> tags = new ArrayList<>();
            JSONObject tag = new JSONObject();
            tag.put("tagCode", "gameServer");
            tags.add(tag);
            keyPropertie.put("tags", tags);
            keyProperties.add(keyPropertie);
            result.put("keyProperties", keyProperties);

            //召唤师等级
            List<JSONObject> extProperties = new ArrayList<>();
            JSONObject extLevel = new JSONObject();
            extLevel.put("propertyId", 1642580017625086l);
            extLevel.put("value", "30");
            extProperties.add(extLevel);
            //贵族等级
            JSONObject vipLevel = new JSONObject();
            vipLevel.put("propertyId", 1642580017634100l);
            vipLevel.put("value", "2");
            extProperties.add(vipLevel);
            //段位
            JSONObject level = new JSONObject();
            level.put("propertyId", 1642580017638107l);
            level.put("value", "白银");
            extProperties.add(level);
            //荣耀水晶数量
            JSONObject shuijing = new JSONObject();
            shuijing.put("propertyId", 1642580017692203l);
            shuijing.put("value", "20");
            extProperties.add(shuijing);
            //五级铭文数量
            JSONObject mingwqen = new JSONObject();
            mingwqen.put("propertyId", 1642580018324633l);
            mingwqen.put("value", "10");
            extProperties.add(mingwqen);
            //英雄数量
            JSONObject yingxiong = new JSONObject();
            yingxiong.put("propertyId", 1642580017750275l);
            yingxiong.put("value", "9");
            extProperties.add(yingxiong);
            //稀有英雄
            JSONObject xiyou = new JSONObject();
            xiyou.put("propertyId", 1642580017964154l);
            xiyou.put("value", "无");
            extProperties.add(xiyou);
            //皮肤数量
            JSONObject pifu = new JSONObject();
            pifu.put("propertyId", 1642580017959146l);
            pifu.put("value", "9");
            extProperties.add(pifu);
            //典藏皮肤
            JSONObject diancang = new JSONObject();
            diancang.put("propertyId", 1642580017990187l);
            diancang.put("value", "无");
            extProperties.add(diancang);
            //限定传说
            JSONObject xianding = new JSONObject();
            xianding.put("propertyId", 1642580018247527l);
            xianding.put("value", "无");
            extProperties.add(xianding);
            //史诗皮肤
            JSONObject shishi = new JSONObject();
            shishi.put("propertyId", 1642580018047260l);
            shishi.put("value", "无");
            extProperties.add(shishi);
            //星元皮肤
            JSONObject xingyuan = new JSONObject();
            xingyuan.put("propertyId", 1642580018024229l);
            xingyuan.put("value", "无");
            extProperties.add(xingyuan);
            //成人号
            JSONObject chengren = new JSONObject();
            chengren.put("propertyId", 1642580018332644l);
            chengren.put("value", "无");
            extProperties.add(chengren);
            //帐号绑定
            JSONObject zhanghaob = new JSONObject();
            zhanghaob.put("propertyId", 1642580018350660l);
            zhanghaob.put("value", "5");
            extProperties.add(zhanghaob);
            //实名
            JSONObject shiming = new JSONObject();
            shiming.put("propertyId", 1691487392896683l);
            shiming.put("value", "可二次实名");
            extProperties.add(shiming);
            //普通传说
            JSONObject putongchuanshuo = new JSONObject();
            putongchuanshuo.put("propertyId", 1701153190846854l);
            putongchuanshuo.put("value", "无");
            extProperties.add(putongchuanshuo);

            //下面三个不知道是啥，默认无
            JSONObject def = new JSONObject();
            def.put("propertyId", 1646274229975286l);
            def.put("value", "无");
            extProperties.add(def);
            def = new JSONObject();
            def.put("propertyId", 1646276359287233l);
            def.put("value", "无");
            extProperties.add(def);
            def = new JSONObject();
            def.put("propertyId", 1707120222323824l);
            def.put("value", "无");
            extProperties.add(def);
            def = new JSONObject();
            result.put("extProperties", extProperties);

            List<JSONObject> safeProperties = new ArrayList<>();
            for (JSONObject extProperty : extProperties) {
                JSONObject safePropertie = new JSONObject();
                Long propertyId = extProperty.getLong("propertyId");
                String value = extProperty.getString("value");
                safePropertie.put("propertyId", propertyId);
                safePropertie.put("value", value);
                safeProperties.add(safePropertie);
            }
            result.put("safeProperties", safeProperties);

            List<JSONObject> sellerAccountProperties = new ArrayList<>();
            //qq账号
            JSONObject sellerAccount = new JSONObject();
            sellerAccount.put("propertyId", "1642580017622083");
            sellerAccountProperties.add(sellerAccount);
            //qq密码
            JSONObject sellerPwd = new JSONObject();
            sellerPwd.put("propertyId", "1642580017630093");
            sellerPwd.put("value", "qwer1234");
            sellerAccountProperties.add(sellerPwd);
            //手机号
            JSONObject sellerTel = new JSONObject();
            sellerTel.put("propertyId", "1642580018345655");
            sellerTel.put("value", "17737053518");
            sellerAccountProperties.add(sellerTel);
            result.put("sellerAccountProperties", sellerAccountProperties);


            List<JSONObject> performanceProperties = new ArrayList<>();
            result.put("performanceProperties", performanceProperties);
            List<JSONObject> goodsSellingScene = new ArrayList<>();
            result.put("goodsSellingScene", goodsSellingScene);
            List<JSONObject> fulfillmentSelect = new ArrayList<>();
            result.put("fulfillmentSelect", fulfillmentSelect);

            //价格标题等属性
            result.put("price", 200);
            result.put("title", "不经常玩，看上的联系");
            result.put("description", "不经常玩，看上的联系");
            result.put("storage", "1");
            JSONObject insuranceRef = new JSONObject();
            insuranceRef.put("current", null);
            result.put("insuranceRef", insuranceRef);

            //图片
            List<JSONObject> imageIdList = new ArrayList<>();
            JSONObject imgJson = new JSONObject();
            imgJson.put("url", "https://static-cdn.jiaoyimao.com/jym-oss/resource/item/1544521729220323/20240227" +
                    "/98814f5027274f43a79737e53c1e662a.jpg");
            imgJson.put("onlinePath", "/jym-oss/resource/item/1544521729220323/20240227" +
                    "/98814f5027274f43a79737e53c1e662a.jpg");
            imgJson.put("width", "800");
            imgJson.put("height", "650");
            imgJson.put("originFileSize", "603169");
            imgJson.put("compressFileSize", "94837");
            imgJson.put("status", "1");
            imgJson.put("failReason", "找不到图片对应场景");
            imgJson.put("recognizeId", "7168164386461586947");
            imageIdList.add(imgJson);
            result.put("imageIdList", imageIdList);

            JSONObject gameProperty = new JSONObject();
            gameProperty.put("platformId", "3");
            gameProperty.put("pid", "1");
            gameProperty.put("cid", "1642580017608072");
            gameProperty.put("clientId", "1470047031280559");
            gameProperty.put("gameId", "1002416");
            gameProperty.put("isNineGameAccount", "false");
            gameProperty.put("isLingXiAccount", "false");
            gameProperty.put("isAliGameAccount", "false");
            gameProperty.put("isTransfer", "false");
            gameProperty.put("platformName", "苹果");
            gameProperty.put("serverId", "1498479938499394");
            gameProperty.put("isSupportImageRecognize", "true");
            gameProperty.put("isFinishAccount", "true");
            gameProperty.put("categoryName", "QQ帐号（旧）");
            result.put("gameProperty", gameProperty);

            result.put("modelType", "H5");
            result.put("categoryId", "1642580017608072");
            result.put("categoryId", "1642580017608072");

            JSONObject addlService = new JSONObject();
            addlService.put("supportBargain", false);
            result.put("addlService", addlService);
            result.put("publishMode", 1);
            result.put("isImageRecognize", true);
            result.put("securityModelType", "h5_ios");
            result.put("goodsDefTravelContent", "{\"forceBargain\":true}");

        }
        return result;
    }


    static HttpResponse getToken() {
        String t = String.valueOf(new Date().getTime());
        String token = "e2a7c26a6f259abbfbf16c92baa01906";
        String _m_h5_tk = token + "_" + t;
        //先请求一个cookie为空

        HttpResponse response = getRes(null, t, token, null);
        String body = response.body();
        log.info("第一次请求={}", body);


        return response;
    }


    public static HttpResponse getRes(String cookie, String t, String token, String data) {

        String baseUrl = "https://mtop.jiaoyimao.com/h5/mtop.com.jym.layout.hsf.goodslist.getgoodslist/1.0/";
        String jsv = "2.7.2";
        String s = "12574478";

        StringBuffer query = new StringBuffer();
        query.append(token).append("&").append(t).append("&").append(s).append("&").append(data);
        String algSign = DigestUtils.md5Hex(query.toString());
        HttpResponse response = HttpRequest.get(baseUrl)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .form("type", "originaljson")
                .form("v", "1.0")
                .form("valueType", "original")
                .form("dataType", "json")
                .form("api", "mtop.com.jym.layout.hsf.goodslist.getGoodsList")
                .form("preventFallback", "true")
                .form("data", data)
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"5541701826074943\",\"ssids\":\"5541701826074943\"," +
                        "\"platform\":\"JYM_IOS_TOUCH\",\"plat\":\"JYM_IOS_TOUCH\",\"osCode\":\"ios\"," +
                        "\"chCode\":\"h5\"," +
                        "\"ch\":\"10438\",\"vername\":\"\"}")
                .header("cookie", cookie)
                .execute();
        return response;
    }


    public static void uoload(String accessKeyId, String accessKeySecret, String securityToken, byte[] content,
                              String objectName) throws Exception {
        // Endpoint以华东1（杭州）为例，其它Region请按实际情况填写。
        String endpoint = "oss-cn-zhangjiakou.aliyuncs.com";
        // 从环境变量中获取访问凭证。运行本代码示例之前，请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
        CredentialsProvider credentialsProvider = new DefaultCredentialProvider(accessKeyId, accessKeySecret,
                securityToken);
        // 填写Bucket名称，例如examplebucket。
        String bucketName = "jym-static";
        // 填写Object完整路径，完整路径中不能包含Bucket名称，例如exampledir/exampleobject.txt。


        // 创建OSSClient实例。
        OSS ossClient = new OSSClientBuilder().build(endpoint, credentialsProvider);

        try {
            // 创建PutObjectRequest对象。
            PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName,
                    new ByteArrayInputStream(content));

            // 创建PutObject请求。
            PutObjectResult result = ossClient.putObject(putObjectRequest);

            log.info("PutObjectResult={}", result);

        } catch (OSSException oe) {
            System.out.println("Caught an OSSException, which means your request made it to OSS, "
                    + "but was rejected with an error response for some reason.");
            System.out.println("Error Message:" + oe.getErrorMessage());
            System.out.println("Error Code:" + oe.getErrorCode());
            System.out.println("Request ID:" + oe.getRequestId());
            System.out.println("Host ID:" + oe.getHostId());
        } catch (ClientException ce) {
            System.out.println("Caught an ClientException, which means the client encountered "
                    + "a serious internal problem while trying to communicate with OSS, "
                    + "such as not being able to access the network.");
            System.out.println("Error Message:" + ce.getMessage());
        } finally {
            if (ossClient != null) {
                ossClient.shutdown();
            }
        }
    }


    static String getArea(String cookie, String t, String token, String gameId) {
        String baseUrl = "https://www.jiaoyimao.com/pc/ajax/SellerAjax/getGoodsCategorysByGameId?gameId=" + gameId +
                "&platformId=2";
        String jsv = "2.7.2";
        String s = "12574478";

        StringBuffer query = new StringBuffer();
        query.append(token).append("&").append(t).append("&").append(s).append("&").append("data");
        String algSign = DigestUtils.md5Hex(query.toString());
        String response = HttpRequest.get(baseUrl)
                .form("jsv", jsv)
                .form("appKey", s)
                .form("t", t)
                .form("sign", algSign)
                .form("type", "originaljson")
                .form("v", "1.0")
                .form("valueType", "original")
                .form("dataType", "json")
                .form("api", "mtop.com.jym.layout.hsf.goodslist.getGoodsList")
                .form("preventFallback", "true")
                .header("authority", "mtop.jiaoyimao.com")
                .header("accept", "application/json")
                .header("content-type", "application/x-www-form-urlencoded")
                .header("jym-meta-h5", "{\"sid\":\"5541701826074943\",\"ssids\":\"5541701826074943\"," +
                        "\"platform\":\"JYM_IOS_TOUCH\",\"plat\":\"JYM_IOS_TOUCH\",\"osCode\":\"ios\"," +
                        "\"chCode\":\"h5\",\"ch\":\"10438\",\"vername\":\"\"}")
                .header("cookie", cookie)
                .execute().body();
        return response;
    }

    private List<GameAttribute> getGameAttributs(String ids) {
        List<GameAttribute> list = new ArrayList<>();
        if (StringUtils.isNotEmpty(ids)) {
            list = gameAttributeMapper.selectGameAttributeListByIds((Long[]) ConvertUtils.convert(ids.split(","),
                    Long.class));
        }
        return list;
    }

    private String reIds(String allIds, String ids) {
        if (StringUtils.isNotEmpty(ids)) {
            if (StringUtils.isNotEmpty(allIds)) {
                allIds = allIds + "," + ids;
            } else {
                allIds = ids;
            }
        }
        return allIds;
    }
}

